Add Panel as Child in State : Panel Children « Container « Flex






Add Panel as Child in State

Add Panel as Child in 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="contact">
            <mx:AddChild position="lastChild">
                <mx:Panel x="200" y="10" width="250" height="150" layout="absolute" title="Question">
                    <mx:Label x="10" y="10" text="Enter your name:" />
                    <mx:TextInput x="10" y="36" />
                    <mx:Button x="10" y="60" label="Submit" click="currentState = 'thankYou'" />
                </mx:Panel>
            </mx:AddChild>
        </mx:State>
        <mx:State name="thankYou" basedOn="contact">
            <mx:AddChild position="lastChild">
                <mx:Panel x="71" y="200" width="250" height="100" layout="absolute" title="Thank You">
                    <mx:Text x="10" y="10" text="Thank you." width="198" />
                    <mx:Button x="82" y="43" label="OK" click="currentState = ''" />
                </mx:Panel>
            </mx:AddChild>
        </mx:State>
    </mx:states>
    <mx:Panel x="10" y="10" width="250" height="100" layout="absolute" title="Title">
        <mx:Text x="10" y="5" text="test." width="210" />
        <mx:LinkButton x="10" y="34" label="Click Here to E-mail Us" color="#0000FF" click="currentState = 'contact'" />
    </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Children of Panel are not instantiated when the application is first loaded, but only after the user clicks the buttonChildren of Panel are not instantiated when the application is first loaded, but only after the user clicks the button
2.Add Sprite object as a child of UIComponent before adding it to PanelAdd Sprite object as a child of UIComponent before adding it to Panel
3.Remove child from PanelRemove child from Panel
4.Panel with 3 ChildrenPanel with 3 Children
5.Set the padding to 10 pixels, and the gap to 5 pixels, for the children of a Panel container:Set the padding to 10 pixels, and the gap to 5 pixels, for the children of a Panel container:
6.Four parts of a form, you define each child panel by using the Form containerFour parts of a form, you define each child panel by using the Form container
7.Children of panel containers are hidden while the containers resizeChildren of panel containers are hidden while the containers resize