# Multidirectionnal Pan scrolling

**URL:** https://forum.kirupa.com/t/multidirectionnal-pan-scrolling/222069
**Category:** flash
**Created:** [April 10, 2007, 3:33pm UTC](https://forum.kirupa.com/t/multidirectionnal-pan-scrolling/222069 "2007-04-10T15:33:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Billybobbonnet](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@Billybobbonnet](https://forum.kirupa.com/u/Billybobbonnet)
#### Post date: [April 10, 2007, 3:33pm UTC](https://forum.kirupa.com/t/multidirectionnal-pan-scrolling/222069/1 "2007-04-10T15:33:46Z")

</div>

Hello,

I found a tutorial on your website "[\*\*Interactive \*\*Image Panning"](http://www.kirupa.com/developer/flash8/interactive_image_pan.htm) with a very nice panning effect. I’m working on panoramic video and I’m trying to do a flash player with a scrolling on the X axis and also the Y. I began to do each variable another time with Y but it don’t works.  
Does anyone knows why it doesn’t work?  
Here is the code:

[COLOR=#000080]this.onMouseMove = function() {  
constrainedMove(bg\_mc, 4, 1);  
};  
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {  
var nSpeed\_x :Number = 0;  
var nSpeed\_y :Number = 0;  
var nMousePercent\_x :Number = this.\_xmouse/Stage.width;  
var nMousePercent\_y :Number = this.\_ymouse/Stage.height;  
if (dir == 1) {  
nSpeed\_x = 1-nMousePercent\_x;  
nSpeed\_y = 1-nMousePercent\_y;  
} else {  
nSpeed\_x = nMousePercent\_x;  
nSpeed\_y = nMousePercent\_y;  
}  
target.destX = Math.round(-((target.\_width-Stage.width)_nSpeed\_x));  
target.destY = Math.round(-((target.\_height-Stage.height)nSpeed\_y));  
target.onEnterFrame = function() {  
if (target.\_x == target.destX) {  
delete target.onEnterFrame;  
} else {  
target.\_x += Math.ceil((target.destX-target.\_x)(speed/100));  
}  
if (target.\_y == target.destY) {  
delete target.onEnterFrame;  
} else {  
target.\_y += Math.ceil((target.destY-target.\_y)_(speed/100));  
}  
}  
}[/COLOR]

Thanks,

Very best [](http://www.kirupa.com/developer/flash8/interactive_image_pan.htm)
