Add child relative to an existing control in State
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:states> <mx:State name="newCheckbox"> <mx:AddChild relativeTo="{vbox}"> <mx:CheckBox id="checkbox" label="New Checkbox" /> </mx:AddChild> </mx:State> <mx:State name="newTextArea"> <mx:AddChild relativeTo="{vbox}"> <mx:TextArea id="textarea" /> </mx:AddChild> </mx:State> </mx:states> <mx:VBox id="vbox1"> <mx:Button label="Click" click="currentState='newCheckbox'" /> <mx:Button label="Click 1" click="currentState='newTextArea'" /> <mx:VBox id="vbox"> <mx:Label text="Click"/> </mx:VBox> </mx:VBox> </mx:Application>