Mega Code Archive

 
Categories / Flex / Container
 

Control the Visibility and Layout of Children

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">     <mx:HBox width="600" height="400">         <mx:Script>                              import mx.core.UIComponent;                      private function removeFromLayout(event:MouseEvent):void                 {                     (event.target as UIComponent).includeInLayout = false;                     (event.target as UIComponent).startDrag();                 }                      private function reincludeInLayout(event:MouseEvent):void                 {                     (event.target as UIComponent).stopDrag();                     (event.target as UIComponent).includeInLayout = true;                 }                              </mx:Script>         <mx:VBox>             <mx:Button id="button" label="My First Button" mouseDown="removeFromLayout(event)" mouseUp="reincludeInLayout(event)"/>         </mx:VBox>     </mx:HBox> </mx:Application>