Creating a simple view state
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:states> <mx:State name="NewButton"> <mx:AddChild relativeTo="{v1}"> <mx:Button id="b2" label="New Button" /> </mx:AddChild> <mx:SetProperty target="{b1}" name="enabled" value="false" /> </mx:State> </mx:states> <mx:VBox id="v1"> <mx:Button id="b1" /> <mx:Button label="NewButton state" click="currentState = 'NewButton';" /> <mx:Button label="base view state" click="currentState = '';" /> </mx:VBox> </mx:Application>