Create a basic application

An application must set valuesImpl and 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

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>

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:local="*">
    <js:valuesImpl>
        <js:SimpleCSSValuesImpl/>
    </js:valuesImpl>
    <js:initialView>
        <local:MyView/>
    </js:initialView>
</js:Application>
  • No labels