O'Reilly logo

Learning Flex 4 by Elijah Robison, Alaric Cole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing States in Design Mode

First, create a fresh project called StageRight, switch to Design mode, delete the Application container’s height and width properties, and give the application a BasicLayout. This demo uses a single Button, so drag a Button control into the application and drop it somewhere near the lower-left corner.

Creating a New State

Now we’ll use the States pane to create a new state. If the States pane isn’t visible, you can show it by selecting Window→States. In the States pane, you should see State1, the default state. All applications are considered to have at least one state, which is their default, or base state. You can create a new state based upon the base state by clicking the New State button in the States pane, as shown in Figure 13-3.

Creating a new state in the States pane

Figure 13-3. Creating a new state in the States pane

Clicking the New State button brings up a dialog box asking for information about the new state, as shown in Figure 13-4. You can give the state any name you want, but as always, it’s best to be descriptive. For this example, call the state stageRight because all this state will do is move the Button to the right.

The New State dialog box

Figure 13-4. The New State dialog box

Editing State Properties

To keep our code clean and readable, let’s edit the generically named State1 so it’s in keeping with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required