# Image Pan positioning

**URL:** https://forum.kirupa.com/t/image-pan-positioning/247600
**Category:** flash
**Created:** [December 27, 2007, 1:12am UTC](https://forum.kirupa.com/t/image-pan-positioning/247600 "2007-12-27T01:12:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![action015](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@action015](https://forum.kirupa.com/u/action015)
#### Post date: [December 27, 2007, 1:12am UTC](https://forum.kirupa.com/t/image-pan-positioning/247600/1 "2007-12-27T01:12:21Z")

</div>

Hello, I Found this website when I am looking for a Image Pan positioning solution.  
eg:[http://www.sephiroth.it/tutorials/flashPHP/scrollRect/index.php](http://www.sephiroth.it/tutorials/flashPHP/scrollRect/index.php)  
Following code is what I found here coded by Krilnon.  
Looks like I need to use xy instead of x, anyone know how to archive that?  
Many thanks!:ne:

```auto
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {
    var mousePercent:Number = _ymouse/Stage.height;
     var mSpeed:Number;
     if (dir == 1) {
        mSpeed = 1-mousePercent;
    } else {
    mSpeed = mousePercent;
 }
target.destY = Math.round(-((target._height-Stage.height)*mSpeed));
target.onEnterFrame = function() {
     if (target._y == target.destY) {
     delete target.onEnterFrame;
} else {
     target._y += Math.ceil((target.destY-target._y)*(speed/100));
}
};
}

```
