# Help with interactive image panning

**URL:** https://forum.kirupa.com/t/help-with-interactive-image-panning/226705
**Category:** flash
**Created:** [May 23, 2007, 10:40am UTC](https://forum.kirupa.com/t/help-with-interactive-image-panning/226705 "2007-05-23T10:40:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bo\_doodle](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@bo\_doodle](https://forum.kirupa.com/u/bo_doodle)
#### Post date: [May 23, 2007, 10:40am UTC](https://forum.kirupa.com/t/help-with-interactive-image-panning/226705/1 "2007-05-23T10:40:57Z")

</div>

Hi I’ve been following the tutorial on the site for interactive image panning, but i would like to be able to pan both on the x and y axis, i’ve been trying various things but with no luck, can anyone point out how i go about adjusting the code to do X & Y?

do i need to create a whole new function fo the Y or can i incorporate it into the current code.

help is great;y appreciated

```auto
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {
    var mousePercent:Number = _xmouse/Stage.width;
    var mSpeed:Number;
    if (dir == 0) {
        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 {
            target._x += Math.ceil((target.destX-target._x)*(speed/18));
        }
    };
}

```

thanks for your help

bo
