Accessibility

Table of Contents

Building Flex Applications with Progressive Layout

Controlling the Order of Progressive Layout

By default, Flex will create the children of the queued containers in the order in which they appear in the MXML document. If you want more control over the order in which the components are created, then you can use the creationIndex property on the Container class. The following example demonstrates how to use the creationIndex property. In this example, Button 3 is created first, followed by Button 2 and then Button 1 (see Figure 2):

<?xml version="1.0" encoding="utf-8"?>
<!-- creationIndexExample.mxml -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

<mx:Panel creationPolicy="queued" creationIndex="3" width="25%" height="100">
    <mx:Button label="Button 1"/>
</mx:Panel>
<mx:Panel creationPolicy="queued" creationIndex="2" width="25%" height="100">
    <mx:Button label="Button 2"/>
</mx:Panel>
<mx:Panel creationPolicy="queued" creationIndex="1" width="25%" height="100">
    <mx:Button label="Button 3"/>
</mx:Panel>

</mx:Application>

Using the creationIndex property to create buttons in reverse order

Figure 2. Using the creationIndex property to create buttons in reverse order (creation order shown in red)