IN THIS CHAPTER
“How’s that shopping cart coming?” ... ... “...how ’bout now?”
View states can add another level of dynamics to your UI. States allow you to present different layout arrangements to support specific conditions. For instance, an application that recognizes different permissions between user accounts might provide a read-only state for some users while enabling an editing state for managers and administrators.
States provide a clean method of grouping modest UI changes into organized, understandable chunks. In other words, a state is a collection of changes to properties, styles, or behaviors of your UI components.
Of course, a developer could accomplish the same results using a series of functions to impose a batch of changes to the UI, but the MXML approach used by Flex is both easier to read and quicker to write—and with Flash Builder, you can always use Design mode to help you get started.
Think about the
YahooSearch application you built in Chapter 11. In that example, the person using your utility sees an empty results list and the search field when she loads the application. Although there’s nothing mechanically wrong with that, it doesn’t make sense to show the results list until there are actual results to view. You could set the results list to invisible when the ...