IN THIS CHAPTER
Create view states in the main application
Modify a state's contents
Create view states within components
Work with components with default view states
Trigger view state changes with buttons
Animate transitions between view states
View states in a Flex application are roughly equivalent to pages in a traditional Web application. Anytime you need to change the appearance of either your entire application, or just a portion of it, you can use view states. Setting up view states in the application requires nothing more than creating a new state and then modifying its contents.
Components can contain states as well; custom components have states created in the same manner as the application, while many user interface components come with a set of pre-defined view states.
The Pages/States panel in Catalyst allows you to create and manage view states. A new application will have a single state, but the panel allows you to create as many additional states as you want. States can either be created as duplicates of an existing state or as new blank states.
Catalyst gives each state a default name of Page1, Page2, and so forth. You should give each state a logical name descriptive of its contents or purpose in the application. State names can contain only letters, numbers and underscores; you cannot use spaces.
The exercises in this chapter build on the application as of the end of Chapter 22