9 Replies Latest reply on Dec 16, 2009 12:12 PM by cheftimo

    Transition not fully working.

    Gregory Lafrance Level 6

      The first time I click the button this transition is not working, but after that it works fine. Any ideas?

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
          <![CDATA[
          ]]>
        </mx:Script>
        <mx:Button id="toBlueBtn" label="To Blue State" click="currentState='blueState'"/>
        <mx:VBox id="redVB" width="100" height="100" backgroundColor="0xFF0000"/>
        <mx:states>
          <mx:State name="blueState">
            <mx:AddChild>
              <mx:Button id="toRedBtn" label="To Red State" click="currentState=''"/>
            </mx:AddChild>
            <mx:AddChild>
              <mx:VBox id="blueVB" width="100" height="100" backgroundColor="0x0000FF"/>
            </mx:AddChild>
            <mx:RemoveChild target="{toBlueBtn}"/>
            <mx:RemoveChild target="{redVB}"/>
          </mx:State>
        </mx:states>
        <mx:transitions>
          <mx:Transition fromState="*" toState="blueState">
            <mx:Sequence>
              <mx:Fade targets="{[toBlueBtn, redVB]}" alphaFrom="1" alphaTo="0" duration="500"/>      
              <mx:Fade targets="{[toRedBtn, blueVB]}" alphaFrom="0" alphaTo="1" duration="500"/>      
            </mx:Sequence>
          </mx:Transition>
          <mx:Transition fromState="blueState" toState="*">
            <mx:Sequence>
              <mx:Fade targets="{[toRedBtn, blueVB]}" alphaFrom="1" alphaTo="0" duration="500"/>      
              <mx:Fade targets="{[toBlueBtn, redVB]}" alphaFrom="0" alphaTo="1" duration="500"/>      
            </mx:Sequence>
          </mx:Transition>
        </mx:transitions>
      </mx:WindowedApplication>