2 Replies Latest reply on Aug 16, 2006 1:32 PM by Bill White

    Transition Question

    Bill White
      How do I perform a transition involving multiple components, each with multiple states? I understand how to do simple transitions when the components I'm working with are all at the same 'level'. But suppose I have three components (X, Y, and Z) , and each of those has two states (Open, Close). Then, suppose I want to perform a transition that has three major movements. The first movement would be to make component X move to the CLOSE state, thereby performing a transition within that component. Then, when that 'sub-transition' within that component is complete, I want to notify the component Y to move to the OPEN state, thereby triggering another transition within component Y. After that is done, component Z can be triggered into the OPEN state as well via its own internal transition. I'm having a hard time trying to understand how to orchestrate this sequence, which I think has to be controlled at the parent component level of these components. I'm not sure how to trigger one state move, then wait for it to finsh before triggering another. I'm imaging this as some sort of Transition that triggers child transitions in the child components, but I'm just not sure. Any ideas?
        • 1. Re: Transition Question
          peterent Level 2
          I have to admit that it is a bit hard to get my head around what you are trying to do, but I understand the basics of it anyway, I just hope I understand it enough to give you some pointers.

          Let's get component X to CLOSE followed by component Y to OPEN. I also have to admit that I haven't tried this before writing this, so it may not work (but when I get a moment I will test this out).

          In component X:

          <mx:transition ...>
          <mx:Sequence effectEnd="notifyOnEnd()">

          Then function notifyOnEnd() { dispatchEvent( new EffectEvent("effectEnd",true)) }

          When the sequence of events in component X end, it will dispatch another effectEnd.

          In the file with both components X and Y, do this:

          <compX effectEnd="compY.currentState='openState'" >

          When component X's effects end, an effectEnd gets dispatched which in the event handler, switches component Y's state.

          There may be a way to do this in the file containing X and Y using states and transitions, but I do know this would work.
          • 2. Re: Transition Question
            Bill White Level 1
            Based on your reply, I think you understand exactly what I'm asking and I was able to make your solution work! Thanks!