# Image pan

**URL:** https://forum.kirupa.com/t/image-pan/220850
**Category:** Uncategorized
**Created:** [March 29, 2007, 9:03pm UTC](https://forum.kirupa.com/t/image-pan/220850 "2007-03-29T21:03:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![haam](https://avatars.discourse-cdn.com/v4/letter/h/a698b9/32.png) [@haam](https://forum.kirupa.com/u/haam)
#### Post date: [March 29, 2007, 9:03pm UTC](https://forum.kirupa.com/t/image-pan/220850/1 "2007-03-29T21:03:05Z")

</div>

hi - working on a photographer’s portfolio and i need to apply the ever-so-popular user ability to zoom into a photo and then pan the image vertically to see the rest of the masked image.

i checked out the Image panning tutorial and that works great if you’re math is in reference to the stage, but when i change it to reference the mask it doesn’t work the same.

can someone help?

```auto
onEnterFrame = function () {
    xPos = -(_xmouse * (container._width - Stage.width) / Stage.width)
    yPos = -(_ymouse * (container._height - Stage.height) / Stage.height)

    var xMover:Tween = new Tween(container, "_x", Elastic.easeOut, container._x, xPos, 5, true);
    var yMover:Tween = new Tween(container, "_y", Elastic.easeOut, container._y, yPos, 5, true);
};

```

so there is the code i’m using. two things: 1) when you resize the stage it doesn’t work anymore and 2) i need to apply this to an image behind a mask, not just the entire stage:

![](http://www.multimediahaam.com/storage/example.gif)
