Use Transition to add and remove controls dynamically : Transition « Effects « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Effects » TransitionScreenshots 
Use Transition to add and remove controls dynamically
Use Transition to add and remove controls dynamically
         
<?xml version="1.0" ?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF">  
  
  <mx:transitions>
    <mx:Transition  fromState="" toState="Description">
       <mx:Sequence target="{vbox1}">
         <mx:Resize duration="500"/>
         <mx:SetPropertyAction name="visible" target="{prodDesc}" value="true" startDelay="500"/>
       </mx:Sequence>
    </mx:Transition>
    <mx:Transition  fromState="Description" toState="">
       <mx:Sequence target="{vbox1}">
         <mx:SetPropertyAction name="visible" target="{prodDesc}" value="false" startDelay="500"/>
         <mx:Resize duration="500"/>
       </mx:Sequence>
    </mx:Transition>
  </mx:transitions>
  
  <mx:states>
    <mx:State name="Description">
      <mx:AddChild relativeTo="{hbox1}" position="before">
        <mx:TextArea width="200" height="180" id="prodDesc" borderStyle="none" visible="false" text="this is a test"/>
      </mx:AddChild>
      <mx:RemoveChild target="{descButton}"/>
      <mx:AddChild relativeTo="{hbox1}" position="before">
        <mx:Button label="Close Description" click="this.currentState=''"/>
      </mx:AddChild>
    </mx:State>
  </mx:states>
  
  <mx:VBox id="vbox1">
    <mx:Label id="productNameTxt" text="Product Name" fontWeight="bold" />
    <mx:Button label="Open Description" click="this.currentState='Description'" id="descButton"/>
    <mx:HBox id="hbox1">
        <mx:Button label="Add to Cart" id="addBtn"/>
    </mx:HBox>
  </mx:VBox>
</mx:Application>

   
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Wrap Parallel, fade and move with TransitionWrap Parallel, fade and move with Transition
2.Define transitions for this example in MXML using the tagDefine transitions for this example in MXML using the <mx:transitions> tag
3.Set control to invisible during transitionSet control to invisible during transition
4.Using a filter in TransitionUsing a filter in Transition
5.Advanced Transitions: Move, Rotate, ResizeAdvanced Transitions: Move, Rotate, Resize
6.Transitions with tagTransitions with <s:transitions> tag
7.Transition With BlursTransition With Blurs
8.Action TransitionsAction Transitions
9.Custom AnimateTransitionShader TransformCustom AnimateTransitionShader Transform
10.Using a filterUsing a filter
11.Defining a custom filterDefining a custom filter
12.Change button position and fade buttonChange button position and fade button
w_w__w._j_av_a_2___s._c__om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.