1 Reply Latest reply on Apr 18, 2006 6:16 AM by Peter Lorent

    Using Tween and easing classes.

    AKIRA_x
      I am using this code:

      quote:


      import mx.transitions.Tween;
      import mx.transitions.easing.*;

      var arrow_1_tween: Object = new Tween(arrow_1, "_x", Elastic.easeOut, 7, 4, 1, true);
      arrow_1_tween.onMotionFinished = function() {
      arrow_1_tween.yoyo();
      };

      var arrow_2_tween: Object = new Tween(arrow_2 "_x", Elastic.easeOut, 12, 9, 1, true);
      arrow_2_tween.onMotionFinished = function() {
      arrow_2_tween.yoyo();
      };



      To animate a mouseover function on a button. This code is on frame 2. So when a used drags his mouse over the button, this code is run:

      quote:


      repeter_btn.onRollOver = function(){
      repeter_btn.gotoAndStop ("on");
      }

      repeter_btn.onRollOut = function(){
      repeter_btn.gotoAndStop ("init");
      }



      The animation code is placed under the "init" label.

      Now the problem is that when I drag the mouse off the button and back on to get the mouseover effect, the animation goes faster, and if I drag it off and on it studders..and stops...and on and on. It seems the animation keeps going AFTER I have draged the mouse off, and when I drag it back on, it builds on the previous run of the code. So everytime I drag the mouse over the code just ads again and again. Why is this?

      Thanks for any help!!

      AKIRA