1 Reply Latest reply on Aug 4, 2007 6:56 AM by kglad

    ActionScript, image pan problem!!!

    BeniDak
      Hello people, I am new to ActionScripting
      and would appreciate any help on this issue:

      Here is the AS Code for the "image pan".

      The image pans fine, but when the mouse is still the image ".Jitters".
      Is there any additional code to stabilize the image when the mouse is
      still and stop the "Jitters"


      Code I am using... below

      __________________________________________________________

      this.onMouseMove = function() {
      constrainedMove(bg_mc, 4, 1);
      };
      function constrainedMove(target:MovieClip, speed:Number, dir:Number) {
      var mousePercent:Number = _xmouse/Stage.width;
      var mSpeed:Number;
      if (dir == 1) {
      mSpeed =1-mousePercent;
      } else {
      mSpeed = mousePercent;
      }
      target.destX = Math.round(-((target._width-Stage.width)*mSpeed));
      target.onEnterFrame = function() {
      if (target._x == target.destX) {
      delete target.onEnterFrame;
      } else if (target._x>target.destX) {
      target._x -= Math.ceil((target._x-target.destX)*(speed/100));
      } else if (target._x<target.destX) {
      target._x += Math.ceil((target.destX-target._x)*(speed/100));
      }
      };
      }

      _________________________________________________________


      Thanks in advance and have a nice day :))

      BeniDak