Friday, March 27, 2009

What is state what is the difference between states and ViewStack

Question :What is state? what is the difference between states and ViewStack?
Answer :The State class defines a view state, a particular view of a component. For example, a product
thumbnail could have two view states; a base view state with minimal information, and a rich view
state with additional information. The overrides property specifies a set of child classes to add or
remove from the base view state, and properties, styles, and event handlers to set when the view state
is in effect. You use the State class in the states property of Flex components. You can only specify a states
property at the root of an application or a custom control, not on child controls.
Diff :
1) View Stack is to handle different MXML file eg TAB control and states is the transition within
single MXML file.
2) ViewStack should be used were there is complete change in the controls used and States should be
used when you just want to add or remove a few components based on certain conditions.
3) ViewStates are virtual state of an existing page apearing at an instance i.e. only one state can be
shown at a time while viewStack are collection of different view containers which can be shown at a time

No comments: