0 Replies Latest reply on Aug 20, 2007 11:02 AM by

    Mouse Controlled movement scripts

      Looking for two movements based on the position of the mouse on the X axis. I have one movie clip that I'd like to move L or R opposite of the direction the mouse is moving in... I've been able to achieve this, but I can't get it to stop at the edge of the MC. The second movie is a circle that I'd like to rotate clockwise (CW) when I move the mouse left, and CCW when I move it right.

      Here is what I used for the L/R movement:

      var centerStage:Number = Stage.width/2;
      var speed:Number = 10;

      _root.onEnterFrame = function() {
      trace(this._xmouse);
      var acc:Number = (this._xmouse - centerStage)/(360/speed);
      hill1._x -= acc;
      hill2._x -= (acc/3);
      hill3._x -= (acc/4);
      hill4._x -= (acc/6);
      hill5._x -= (acc/8);
      hill6._x -= (acc/10);
      };


      Thanks