Mega Code Archive

 
Categories / Flex / Effects
 

Add child before 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" id="formitem2">                     <mx:TextInput/>                 </mx:FormItem>             </mx:AddChild>         </mx:State>         <mx:State name="Check">             <mx:AddChild relativeTo="{form1}" position="lastChild">                 <mx:FormItem label="Routing Number" id="formitema">                     <mx:TextInput/>                 </mx:FormItem>             </mx:AddChild>             <mx:AddChild relativeTo="{form1}" position="lastChild">                 <mx:FormItem label="Account Number" id="formitemb">                     <mx:TextInput/>                 </mx:FormItem>             </mx:AddChild>         </mx:State>     </mx:states>     <mx:transitions>         <mx:Transition id="paymentTransitionCharge" fromState="*" toState="Charge">             <mx:Parallel targets="{[formitem1,formitem2,formitema,formitemb]}">             <mx:Fade duration="400"/>             <mx:Move xFrom="0" yFrom="0" duration="400"/>         </mx:Parallel>         </mx:Transition>             <mx:Transition id="paymentTransitionCheck" fromState="*" toState="Check">                 <mx:Parallel targets="{[formitema,formitemb]}">                 <mx:Fade duration="400"/>                 <mx:Move xFrom="0" yFrom="0" duration="400"/>                 </mx:Parallel>         </mx:Transition>     </mx:transitions>     <mx:Form x="103" y="56" width="397" height="284" 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>