Adding and removing components relativeTo another control
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:states> <mx:State name="newTextInput"> <mx:AddChild relativeTo="{checkbox1}" position="after"> <mx:TextInput id="textinput" /> </mx:AddChild> </mx:State> </mx:states> <mx:VBox id="vbox"> <mx:CheckBox id="checkbox1" label="One" /> <mx:CheckBox id="checkbox2" label="Two" /> <mx:Button id="button" label="Click" click="currentState='newTextInput'" /> </mx:VBox> </mx:Application>