# Help: Image Panning

**URL:** https://forum.kirupa.com/t/help-image-panning/275774
**Category:** flash
**Created:** [November 18, 2008, 4:29pm UTC](https://forum.kirupa.com/t/help-image-panning/275774 "2008-11-18T16:29:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ixjaneix](https://avatars.discourse-cdn.com/v4/letter/i/3bc359/32.png) [@ixjaneix](https://forum.kirupa.com/u/ixjaneix)
#### Post date: [November 18, 2008, 4:29pm UTC](https://forum.kirupa.com/t/help-image-panning/275774/1 "2008-11-18T16:29:16Z")

</div>

I followed everything stated in the tutorial. The tutorial have the left and right panning. Now, I also want to have the up and down panning at the same time. I did it already but panning turned out not smooth. My code is…

this.onMouseMove = function() {  
constrainedMove(bg\_mc, 4, 1);  
};  
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {  
var mousexPercent:Number = \_xmouse/Stage.width;  
var mouseyPercent:Number = \_ymouse/Stage.width;  
var mxSpeed:Number;  
var mSpeed:Number;  
if (dir == 1) {  
mxSpeed = mousexPercent;  
} else {  
mxSpeed = 1-mousexPercent;  
}  
if (dir == 1) {  
mySpeed = mouseyPercent;  
} else {  
mySpeed = 1-mouseyPercent;  
}  
target.destY = Math.round(-((target.\_width-Stage.width)_mySpeed));  
target.onEnterFrame = function() {  
if (target.\_y == target.destY) {  
delete target.onEnterFrame;  
} else {  
target.\_y += Math.ceil((target.destY-target.\_y)_(speed/100));  
}  
target.destX = Math.round(-((target.\_width-Stage.width)_mxSpeed));  
target.onEnterFrame = function() {  
if (target.\_x == target.destX) {  
delete target.onEnterFrame;  
} else {  
target.\_x += Math.ceil((target.destX-target.\_x)_(speed/200));  
}  
};  
};  
}

and here’s the swf file.

if you have any suggestions or anything please let me see the code or the fla/swf file… thanks 😁
