moving 2 movieclips

Out of context: Reply #4

  • Started
  • Last post
  • 32 Responses
  • yah0

    Nice snippit unfittoprint! There's a small error in the code though:

    function move(status, speed) {
    this.speed = speed;
    if (status) {
    this.onEnterFrame = function() {
    movieclip1._x += speed;
    movieclip2._x += speed/2; //for fun...
    }; // left this off
    } else {
    delete this.onEnterFrame;
    }
    }
    //usage
    button.onPress = function() {
    move(true, 5);
    };
    button.onRelease = function() {
    move(false);
    };
    //for motion in the opposite direction use negative speeds.

View thread