Mega Code Archive

 
Categories / Flex / Container
 

Get the number of direct child components in a container

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:Script>                  import mx.controls.Alert;         public function calculateChildren():void {             var myText:String = new String();             myText= myVBox.numChildren + " children";             myText+="\nThe Application has " + numChildren + " children";             Alert.show(myText);         }            </mx:Script>     <mx:VBox id="myVBox" borderStyle="solid">         <mx:Label text="This is label 1" />         <mx:Label text="This is label 2" />         <mx:Label text="This is label 3" />     </mx:VBox>     <mx:Button label="Show Children" click="calculateChildren();" /> </mx:Application>