View-Based Application

The view-based application adds the concept of a navigator, which is a built-in navigation framework specifically made for use within mobile applications. The navigator will manage the screens within your application. Creating a new view-based application within Flash Builder 4.5 will result in the generation of two files. These files are the main application file and the default view that will be shown within your application. Unlike the blank application, where the main application file was created with the <s:Application> as the parent, a view-based application uses the new <s:ViewNavigatorApplication> as its parent, as shown below:

<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.ViewBasedHomeView">
    <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
</s:ViewNavigatorApplication>

The second file that is created is the default view, which is automatically placed in a package named views. In this case it was named ViewBasedHomeView was automatically set as the firstView property of the ViewNavigatorApplication. The autogenerated code for this file is shown below:

<?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) ...

Get Developing iOS Applications with Flex 4.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.