26
DEVELOPING MOBILE APPLICATIONS WITH FLEX AND FLASH BUILDER
User interface and layout
Last updated 9/8/2011
Each view in an application corresponds to a View container defined in an ActionScript or MXML file. Each View
contains a
data
property that specifies the data associated with that view. Views can use the
data
property to pass
information to each other as the user navigates the application.
Use the
ViewNavigatorApplication.firstView
property to specify the file that defines the first view in the
application. In the previous application, the
firstView
property specifies
views.HomeView
. The following example
shows the HomeView.mxml file that defines that view:
<?xml version="1.0" encoding="utf-8"?>
<!-- containers\mobile\views\HomeView.mxml -->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="Home">
<s:layout>
<s:VerticalLayout paddingTop="10"/>
</s:layout>
<s:Label text="The home screen"/>
</s:View>
Lay out a mobile application with multiple sections
A mobile application can collect related views in different sections of the application. For example, the following figure
shows the organization of a mobile application with three sections.
Any section can use any View. That is, a view does not belong to a specific section. The section just defines a way to
arrange and navigate a collection of views. In the figure, the Search view is part of every section of the application.
At runtime, only one view is active and resident in memory. For more information, see "
Navigate the views of a mobile
application
" on page 27.
Classes used in a mobile application with multiple sections
The following table lists the classes that you use to create a mobile application with multiple sections:
Main application (TabbedViewNavigatorApplication)
Contacts (ViewNavigator)
Edit Contacts (View)
Contacts Home (View)
Search (View)
Email (ViewNavigator)
Edit Contacts (View)
Email Home (View)
Search (View)
Favorites (ViewNavigator)
Favorites Home (View)
Search (View)
(TabbedViewNavigator)