Adding Multiple Children in a Flex State
Many times I’ve had to add multiple children in a Flex state. Take the following simple example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | < ?xml version="1.0" encoding="utf-8"?> <mx :Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx :Label id="topLabel" text="Top" /> <mx :Button label="showChildren" click="currentState='children';" /> </mx><mx :states> </mx><mx :State name="children"> </mx><mx :AddChild relativeTo="{topLabel}" position="after"> <mx :Label text="third" /> </mx> <mx :AddChild relativeTo="{topLabel}" position="after"> <mx :Label text="second" /> </mx> <mx :AddChild relativeTo="{topLabel}" position="after"> <mx :Label text="first" /> </mx> |
