Add child to position in a State : State « Effects « Flex
- Flex
- Effects
- State
Add child to position in a State

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:states>
<mx:State name="Charge">
<mx:AddChild relativeTo="{form1}" position="lastChild">
<mx:FormItem label="Charge Number" id="formitem1">
<mx:TextInput/>
</mx:FormItem>
</mx:AddChild>
<mx:AddChild relativeTo="{formitem1}" position="before">
<mx:FormItem label="Name">
<mx:TextInput/>
</mx:FormItem>
</mx:AddChild>
<mx:AddChild relativeTo="{form1}" position="lastChild">
<mx:FormItem label="Submit">
<mx:Button label="Button" click="currentState=''"/>
</mx:FormItem>
</mx:AddChild>
</mx:State>
<mx:State name="Check">
<mx:AddChild relativeTo="{form1}" position="lastChild">
<mx:FormItem label="Routing Number">
<mx:TextInput/>
</mx:FormItem>
</mx:AddChild>
<mx:AddChild relativeTo="{form1}" position="lastChild">
<mx:FormItem label="Submit">
<mx:Button label="Button" click="currentState=''"/>
</mx:FormItem>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Form x="103" y="56" width="397" height="219" id="form1">
<mx:RadioButtonGroup id="radiogroup1"/>
<mx:RadioButton x="143" y="70" label="Check" groupName="radiogroup1"
click="currentState='Check'"/>
<mx:RadioButton x="143" y="94" label="Charge" groupName="radiogroup1"
click="currentState='Charge'"/>
</mx:Form>
</mx:Application>
Related examples in the same category