Chapter 13. Managing View States

IN THIS CHAPTER

  • Understanding view states

  • Defining view states in Design mode

  • Defining view states in MXML

  • Switching view states at runtime

  • Managing view states in components

  • Using transitions to animate view states

Flex applications define view states as particular presentations of a visual component. In each moment of the user's interactions with the application, each visual component presents itself in a particular form known as its current view state. Flex enables you to define as many different view states as you like for the Application and for each of its custom MXML components using declarative code, and then enables you to switch easily between states by setting the Application or custom component's currentState property.

View state management in Flex is designed primarily for application scenarios where the Application or component uses a significant portion of its presentation in multiple situations and makes incremental changes to its presentation for each new situation. This sort of incremental change is different from application navigation, where the user moves between multiple different layers, or views, that don't share content with each other.

In Flex 4, you always declare view states in MXML. In Flex 3, you could also use ActionScript code to declare view states, but the resulting code was verbose and difficult to maintain. Even further, the MXML view state code has been dramatically altered since Flex 3, resulting in much cleaner MXML ...

Get Flash® Builder™ 4 and Flex® 4 Bible 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.