2 Replies Latest reply on Feb 20, 2007 8:22 PM by Rich Rainbolt

    mx.transition.Tween

    G_Swank
      Hi Folks - All I am trying to do is fade one movieClip out, fade another movieClip in and then move on down the timeline.
      I can fade things up and down no problem, but when I enter the "gotoAndStop();" into the equation it overrides the fading process and simply kicks me into the next label/frame on the timeline. In this example everything works beautifully until you get to the line: gotoAndStop(10); - can someone shed some light on this...? This example is just for fadingOut...

      stop();
      import mx.transitions.Tween;

      img2_mc._alpha = 100

      btn_click.onRelease = function(){
      //fadeIN(0, 100);
      fadeOUT(100,0);
      gotoAndStop(10);

      }
      function fadeIN(startAt:Number, endAt:Number):Void {
      var myTween:Tween = new Tween(attachMovie("img1_mc", "img1_mc", 10), "_alpha", mx.transitions.easing.None.easeNone, startAt, endAt, .25, true);
      }
      function fadeOUT(startAt:Number, endAt:Number):Void {
      var myTween:Tween = new Tween(img2_mc, "_alpha", mx.transitions.easing.None.easeNone, startAt, endAt, .25, true);
      }
        • 1. Re: mx.transition.Tween
          G_Swank Level 1
          Never Mind - I figured it out using onMotionFinished.
          • 2. Re: mx.transition.Tween
            Rich Rainbolt Level 1
            Hey there:

            I was just looking for some help with a similar problem and maybe your solution can help me.

            I want to fade one piece of text out and fade one in. The fade out is working fine but it seems to keep looping once the second fade in starts. If you have any suggestions, or if you could show me how you used the onMotionFinished to end the loop I'd appreciate it.

            Here is the relevant code that I have:
            (I have the correct import statements etc.) Like I said the first tween (tweenTxt01) runs (and fades back) nicely,
            the problem is (that it loops - I know this because the trace command repeats in the output window)


            var tweenTxt01:Tween = new Tween(txt01_mc, "_alpha", Strong.easeInOut, 0, 100, fadeIntxtSpeed, true);
            tweenTxt01.onMotionFinished = function():Void {
            var tweenTxtDone_Bool:Boolean = true;
            trace("Line 42 - the value of tweenTxtDone_Bool is "+tweenTxtDone_Bool);
            tweenTxt01.continueTo(0, fadeOutTxtSpeed);
            tweenTxt01.Tween.stop();
            //kick off txt02 tween sequence//
            if (tweenTxtDone_Bool) {
            var tweenTxt02:Tween = new Tween(txt02_mc, "_alpha", Strong.easeInOut, 0, 100, fadeIntxtSpeed, true);
            tweenTxt02.onMotionFinished = function():Void {
            tweenTxt02.continueTo(0, fadeOutTxtSpeed);
            tweenTxt02.Tween.stop();
            stop();
            };
            }
            };

            stop();