1 Reply Latest reply on Jun 17, 2013 5:46 AM by Ned Murphy

    mouse panning

    Emraan.Khan

      hi... my mouse panning not working properly..

      my script is---

       

       

      onClipEvent(load){

          thwidth = this._width;    //Variable for image width

          stwidth = Stage.width;   //Variable for stage width

          speed = 30;

         

      //    The above variable is speed.

      //    The higher the value, the slower the image moves.

      //   

      }

      onClipEvent(enterFrame){

          this._x -= (_root._xmouse-(stwidth/2))/speed;

          //Above line moves the image

         

          if (this._x>=(0+(thwidth/5))){

              this._x = (0+(thwidth/5));

          }

          //If image reaches the end, then stop it.

         

          if (this._x<=5){

              this._x =5;

             

          }

         

          //Same for opposite side.

      }

        • 1. Re: mouse panning
          Ned Murphy Adobe Community Professional & MVP

          The following enterFrame should work if the registration for the movieclip is in the upper left corner:

           

          onClipEvent(enterFrame){

           

              this._x -= (_root._xmouse-(stwidth/2))/speed;

           

              //Above line moves the image

           

              if (this._x>=0){
                  this._x = 0;
              }

           

              //If image reaches the end, then stop it.

           

              if (this._x<= stwidth-thwidth){
                  this._x = stwidth-thwidth;
              }

           

              //Same for opposite side.
          }