Adobe Flex 3 Help

Adding containers to the queue

You can add any number of containers to the instantiation queue so that their contents are displayed in queue order. To add a container to the instantiation queue, you set the value of the container's creationPolicy property to queued. Unless you specify a queue order, containers are instantiated and displayed in the order in which they appear in the application source code.

In the following example, the Panel containers and their child controls are added to the instantiation queue. To the user, each Panel container appears one at a time during the application startup. The perceived startup time of the application is greatly reduced. The panels are created in the order that they appear in the source code (panel1, panel2, panel3):

<?xml version="1.0"?>
<!-- layoutperformance/QueuedCreationPolicy.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Panel id="panel1" creationPolicy="queued" width="100%" height="33%">
        <mx:Button id="button1a" label="Button 1A"/>
        <mx:Button id="button1b" label="Button 1B"/>
    </mx:Panel>

    <mx:Panel id="panel2" creationPolicy="queued" width="100%" height="33%">
        <mx:Button id="button2a" label="Button 2A"/>
        <mx:Button id="button2b" label="Button 2B"/>
    </mx:Panel>

    <mx:Panel id="panel3" creationPolicy="queued" width="100%" height="33%">
        <mx:Button id="button3a" label="Button 3A"/>
        <mx:Button id="button3b" label="Button 3B"/>
    </mx:Panel>
</mx:Application>

The executing SWF file for the previous example is shown below:

Flex first creates all the panels. Flex then instantiates and displays all the children in the first panel in the queue before moving on to instantiate the children in the next panel in the queue.

To specify an order for the containers in the instantiation queue, you use the creationIndex property. For more information on using the creationIndex property, see Setting queue order.