actionscript physics stopper

Out of context: Reply #9

  • Started
  • Last post
  • 12 Responses
  • londonBoy0

    A Simple prototype:

    move_x = function(obj, newx, speed) {
    obj.onEnterFrame = function() {
    this._x +=(newx-this._x)/speed;
    if(Math.ceil(this._x)==newx) {
    delete this.onEnterFrame;
    }
    }
    }

    This prototype goes on the actions for a frame. It is activated with:

    move_x(myMovieClip, 320, 6);

    which can be used on a frame action, or in conjunction with a buttons on(release) function.

    what you are concerned with is the "if" statement and the delete function.

    Check you email, I've sent you a .fla

View thread