| Flex 2 Developer's Guide > Flex Programming Topics > Using View States > Defining and applying view states > Applying view states | |||
You can set the view state of any Flex component, including the Application component. A component can have different view states at different times, but is in only one view state at a time.
currentState property specifies its view state. As a general rule, you should use this property to change view states.setCurrentState() method of the UIComponent class. Use this method when you do not want to apply a transition that you have defined between two view states.currentState property to "".The following example code lets the user change between two view states by clicking Button controls; button b1 sets the view state to the newButton state, and button b2 sets the view state to the base state.
<mx:Button id="b1" label="Add a Button" click="currentState='newButton';"/> <mx:Button id="b2" label="Remove Added Button" click="currentState='';"/>
Flex 2.01