0 Replies Latest reply on Aug 22, 2007 3:23 PM by jkahn117

    Dynamically set transition target

    jkahn117
      We are building an application that has multiple steps. As each step is completed, I would like it to move off to the left of the screen with the new screen moving in from the right edge. I am using multiple states and have created a transition that I would like to set the targets as the state is changing. The problem is that the old screen simply disappears, it does not slide away (the new screen does slide in from the right). Any thoughts?

      Code:
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" height="490" width="860"
      currentState="{ model.stateManager.current }"
      currentStateChanging="prepareForStateChange(event);">

      <mx:Script>
      <![CDATA[
      import mx.states.State;
      import mx.events.StateChangeEvent;

      [Bindable] private var model : WMModelLocator = WMModelLocator.getInstance();

      private function prepareForStateChange(event : StateChangeEvent) : void
      {
      if (event.oldState != "")
      {
      this.leftSlide.fromState = event.oldState;
      this.leftSlide.toState = event.newState;

      this.leftSlideOldStateEffect.target = persona;
      this.leftSlideNewStateEffect.target = plan;

      this.leftSlide.effect.play();
      }
      }
      ]]>
      </mx:Script>

      <mx:states>
      <mx:State name="{ StateManager.STATE_PERSONA }">
      <mx:AddChild position="lastChild">
      <persona:SelectPersona id="persona" />
      </mx:AddChild>
      </mx:State>
      <mx:State name="{ StateManager.STATE_PLAN }">
      <mx:AddChild position="lastChild">
      <accum:RetirementPlanning id="plan" />
      </mx:AddChild>
      </mx:State>
      </mx:states>

      <mx:transitions>
      <mx:Transition id="leftSlide">
      <mx:Parallel>
      <mx:Sequence id="leftSlideOldStateEffect">
      <mx:Move xFrom="0" xTo="-1000" duration="2000" />
      <mx:RemoveChildAction />
      </mx:Sequence>
      <mx:Move id="leftSlideNewStateEffect" xFrom="1000" xTo="0" duration="2000" />
      </mx:Parallel>
      </mx:Transition>
      </mx:transitions>
      </mx:Canvas>