1 Reply Latest reply on Apr 3, 2007 8:54 AM by eric76

    Fading problems

      Hello,

      I'm trying to use the following code to fade out my content clip, then change the frame, and then fade it back in.

      quote:

      //Fade out content clip
      import mx.transitions.*;
      import mx.transitions.easing.*;
      TransitionManager.start(contentclip, {type:Fade, direction:Transition.OUT, duration:3, easing:None.easeNone});

      //Change content clip to desired frame
      contentclip.gotoAndStop("inthestudio")

      // Fade in content clip
      import mx.transitions.*;
      import mx.transitions.easing.*;
      TransitionManager.start(contentclip, {type:Fade, direction:Transition.IN, duration:3, easing:None.easeNone});


      What happens, however, is the content goes blank immediately (no fadeout) and then fades in with the correct page.

      I think what's happening is it's reading the fadeout lines of code, and then jumping to the gotoandstop one, effectively cancelling it out. If this is the case, then I'll need to set some sort of delay (3 seconds would be appropriate) in between those lines, but I'm not sure how.

      Thanks in advance for any input :)
        • 1. Re: Fading problems
          eric76 Level 1
          Yes, since all that code will be executed at once, the first transition is cancelled by the goto and the second transition. You should separate out the goto and the second transition by setting up an eventlistener:

          var transitionManagerInstance = new TransitionManager();
          var listenerObject:Object = new Object();
          listenerObject.allTransitionsOutDone = function(eventObj:Object) {
          // make your goto and second transition from here
          // (scope could become a problem, see Delegate for that)
          };
          transitionManagerInstance.addEventListener("allTransitionsOutDone", listenerObject);

          btw, u dont have to make the same import twice.