Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Create a basic application

An application requires a must set valuesImpl and an initialView:

<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:js="library://ns.apache.org/flexjs/basic">
    <js:valuesImpl>
        <js:SimpleCSSValuesImpl/>
    </js:valuesImpl>
    <js:initialView>
        <js:View>
            <js:Label text="Hello World"/>
        </js:View>
    </js:initialView>
</js:Application>

Create the initial view in a separate class

You may separate Move the initial view into a separate class by creating a file named MyView.mxml with the following content:

<js:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:js="library://ns.apache.org/flexjs/basic">
    <js:Label text="Hello World"/>
</js:View>

The application can reference this class to Add a new XML namespace for the package containing MyView. Then, set the initial view:

<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:js="library://ns.apache.org/flexjs/basic"
xmlns:examplelocal="*">
    <js:valuesImpl>
        <js:SimpleCSSValuesImpl/>
    </js:valuesImpl>
    <js:initialView>
        <example <local:MyView/>
    </js:initialView>
</js:Application>