Mega Code Archive

 
Categories / Flex / Container
 

Add Button control as the first child of an HBox container

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:states>         <mx:State name="NewButton">             <mx:AddChild relativeTo="{h1}" position="firstChild">                 <mx:Button id="buttonNew" label="New Button" />             </mx:AddChild>         </mx:State>     </mx:states>     <mx:HBox id="h1">         <mx:Button label="Change State"             click="currentState = currentState=='NewButton' ? '':'NewButton';" />     </mx:HBox> </mx:Application>