| Getting Started with Flex 2 > Lessons > Use View States and Transitions > Design the base state | |||
Before you can use view states, you must design the base state of the application or component. The base state is the default layout of the application or custom component.
In this section, you create a base state by inserting and positioning the controls of a simple search form.
|
NOTE |
|
For the purpose of these lessons, several application files are used in a single Flex Builder project. However, it's good practice to have only one MXML application file per project. |
The layout should look similar to the following example:
The ViewStates.mxml file should contain the following MXML code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel id="panel1" x="5" y="5" width="300" height="400" layout="absolute">
<mx:Label x="20" y="70" text="Search"/>
<mx:TextInput x="20" y="90"/>
<mx:Button x="185" y="90" label="Go"/>
<mx:LinkButton x="20" y="120" label="Advanced Options" id="linkbutton1"/>
</mx:Panel>
</mx:Application>
A browser opens and runs the application.
|
NOTE |
|
The browser must have Flash Player 9 installed to run the application. You have the option of installing Flash Player 9 in selected browsers when you install Flex Builder. To switch to a browser with Flash Player 9, in Flex Builder select Window > Preferences > General > Web Browser. |
Flex 2.01