Specifications

99ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
p = policy.selectedItem.toString();
}
private function changePolicy():void {
var polType:String = policy.value.toString();
hb.creationPolicy = polType;
if (polType == "none") {
// do nothing
} else if (polType == "all") {
hb.createComponentsFromDescriptors();
}
}
]]></mx:Script>
<mx:ComboBox id="policy" close="p=String(policy.selectedItem);changePolicy();">
<mx:dataProvider>
<mx:Array>
<mx:String>none</mx:String>
<mx:String>all</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
<mx:Panel title="Creation Policy" id="hb" creationPolicy="none">
<mx:Button label="B1" width="50" y="0" x="0"/>
<mx:Button label="B2" width="50" y="0" x="75"/>
<mx:Button label="B3" width="50" y="0" x="150"/>
</mx:Panel>
<mx:Label text="CreationPolicy: {p}"/>
</mx:Application>
Using the childDescriptors property
When a Flex application starts, Flex creates an object of type Object that describes each MXML component. These
objects contain information about the component’s name, type, and properties set in the object’s MXML tag. Flex
adds these objects to an Array that each container maintains. For example, applications with two Canvas
containers have an Array with objects that describe the Canvas containers. Those containers, in turn, have an
Array with objects that describe their children.
Each object in the Array is an object of type ComponentDescriptor. You can access this Array by using a
container’s
childDescriptors property, and use a zero-indexed value to identify the descriptor. All containers
have a
childDescriptors property.