3 Replies Latest reply on Apr 23, 2006 6:08 AM by Husain

    Panning Image with mouse with easing

      Hi Fellas,
      I am stuck with something here, and need urgent help.

      I have a movie with a large image and a mask. The image pans based on the mouse position, within the mask. I have the script that does that, but only works if the mask is aligned to the top left of the Stage. If I move the mask, say in the centre of the Stage, the script works fine, but only for the bottom and right most areas of the image. The top and left don't seem to show in that mask. Which to what I understand, the script does not take the left and top positions into account. I don't know how to calculate or derive those valuies, based on the script that I have.

      I have the FLA here: http://www.magnam.com/Projects_2006/pan_test/image_pan.zip for anyone to point me on what am I missing here.

      Thanks in advance.
        • 1. Re: Panning Image with mouse with easing
          Husain Level 1
          Alright Guys,

          Incase anybody was looking into this, I figured out a solution to this. I just nested everything inside an MC and it worked! Determing the co-ordinates of the nested MC against the Stage was where I feel, making the mistake.

          I am a happy man!

          • 2. Re: Panning Image with mouse with easing
            blemmo Level 1
            Ok, you're happy already, that's good.

            I did look into this, and have to say it wasn't too easy to get behind what was wrong. I found this solution to work:
            xRatio = ((_xmouse-leftLimit) / imageMask_mc._width);
            yRatio = ((_ymouse-topLimit) / imageMask_mc._height);
            xPos = Math.round(leftLimit - image_mc._width * xRatio + imageMask_mc._width * xRatio);
            yPos = Math.round(topLimit - image_mc._height * yRatio + imageMask_mc._height * yRatio);

            However, I'm quite confused why you can't use imageMask_mc._xmouse for calculation of the xRatio. That value goes from 0 to 550, but the mask is only 300 wide. Strange...

            Anyway, it's solved, so who cares.

            • 3. Re: Panning Image with mouse with easing
              Husain Level 1
              Thanks for the effort Blemmo.

              I too did try to use the imageMask_mc._xmouse for the ratio, but doesn't work. And you're right, as long as it works, without a glitch, that's more important