Adding and removing components with State
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:states> <mx:State name="newTextInput"> <mx:AddChild> <mx:TextInput id="textinput" /> </mx:AddChild> </mx:State> </mx:states> <mx:Button id="button" label="Click" click="currentState='newTextInput'" /> </mx:Application>