# "Interactive Image Panning" tutorial HELP!

**URL:** <https://forum.kirupa.com/t/interactive-image-panning-tutorial-help/201897>\
**Category:** Uncategorized\
**Created:** [September 26, 2006, 2:51am UTC](https://forum.kirupa.com/t/interactive-image-panning-tutorial-help/201897 "2006-09-26T02:51:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pengwind](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pengwind/32/2859_2.png) [@pengwind](https://forum.kirupa.com/u/pengwind)\
**Post date:** [September 26, 2006, 2:51am UTC](https://forum.kirupa.com/t/interactive-image-panning-tutorial-help/201897/1 "2006-09-26T02:51:00Z")

</div>

ok hello everyone! I’m new on the forum and at using action script.

ok … now my question:

I’ve done the “[COLOR=black]\*\*Interactive \*\*Image Panning” tutorial on [kirupa.com](http://kirupa.com) using [COLOR=red]Flash 8[/COLOR] and I understand all of it’s code.[/COLOR]  
Now I want to use this technique for one of my project but with something diferent:

I wonder if it’s possible for the background to pan only when the mouse is in the “red” zones … pan to the left when in the left zone and to the right when in the right zone. I don’t know if I have to use the mouseOver or anything else. See the image for the “zones”:

There is the actual code after doing the tutorial:

> this.onMouseMove = function() {  
> constrainedMove(bg\_mc, 4, 1);  
> };  
> function constrainedMove(target:MovieClip, speed:Number, dir:Number) {  
> var mousePercent:Number = \_xmouse/Stage.width;  
> var mSpeed:Number;  
> if (dir == 2) {  
> 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 if (target.\_x\>target.destX) {  
> target.\_x -= Math.ceil((target.\_x-target.destX)_(speed/100));  
> } else if (target.\_x\<target.destX) {  
> target.\_x += Math.ceil((target.destX-target.\_x)\*(speed/100));  
> }  
> };  
> }

I would like to use the same attribute like the speed and everything if possible.

Thanks in advance !!!
