16 Replies Latest reply on Oct 26, 2010 4:16 PM by kglad

    [as2] Making a tween without using the tween class

    marcelozep3 Level 1

      Hi.

      Is there any way to make a movie clip start at a given x and y point, and ends at another x and y point, in 90 seconds?.

       

      I´ve done a lot of code but I´m not getting a good result.

       

      The main problem is, I want the movie clip to travel along a straight line. And by this code below the "b" movie clips makes some curves.

       

      Here´s what I´ve done.

       

      "p" is point movie clip

      "b" is ball movie clip

       

       

       

      fullTime = 90000;
      _currentTime = fullTime;
      oldTime = undefined;
      onEnterFrame = function () {
      if (count) {
        _currentTime = _currentTime-(Math.abs(oldTime-getTimer()));
      }
      count = true;
      oldTime = getTimer();
      speedX = (p._x-b._x)/((_currentTime*24)/1000);
      speedY = (p._y-b._y)/((_currentTime*24)/1000);
      b._x += speedX;
      b._y += speedY;
      if (b._y>=p._y) {
        //do something

      }
      };

       

      Thanks