# Need Help with Interactive image panning tuorial

**URL:** <https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568>\
**Category:** flash\
**Created:** [July 10, 2008, 9:06am UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568 "2008-07-10T09:06:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flashr](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@Flashr](https://forum.kirupa.com/u/Flashr)\
**Post date:** [July 10, 2008, 9:06am UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/1 "2008-07-10T09:06:51Z")

</div>

Hi all

Just downloaded the interactive image panning fla and am using the code to move swatches that are buttons…

it works only problem is that once a button is clicked it still pans the buttons around as it is a onMouseMove function.This can confuse the user as they may think it has not been clicked.So what i want is for that panning to stop once one of the panning buttons is clicked.yet still have that panning function if the original button clicked is the wrong one and the user wants to scroll through them again.

If anyone know even what they think they would do or have a link of similar app pls let me know

Thanks

---

<div class="post-metadata">

**Author:** ![graylensman](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@graylensman](https://forum.kirupa.com/u/graylensman)\
**Post date:** [July 10, 2008, 2:58pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/2 "2008-07-10T14:58:01Z")

</div>

What function happens when the button is clicked? How does the user determine if they’ve clicked the wrong button? Cna’t really offer suggestions without more data. 🙂

For similar projects, my scrolling buttons would load images when clicked. The button click would also trip a boolean which deactivates the scrolling function. When the user finished looking at the image, they would click a “close” button that would unload the image and reactivate the scrolling action.

---

<div class="post-metadata">

**Author:** ![Flashr](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@Flashr](https://forum.kirupa.com/u/Flashr)\
**Post date:** [July 10, 2008, 3:18pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/3 "2008-07-10T15:18:46Z")

</div>

hey graylensman

thanks for the reply…here is the code for the panning buttons…got it straight from the kirupa tutorial section under interactive image panning.

[COLOR=“RoyalBlue”]this.onMouseMove = function(){  
constrainedMove(bg\_mc, 4, 0)  
};

function constrainedMove(target:MovieClip, speed:Number, dir:Number) {  
var mousePercent:Number = \_xmouse/Stage.width;  
var mSpeed:Number;  
if (dir == 1) {  
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));  
}  
};  
}[/COLOR]

So i replaced the img that panned with a movie clip that contains my bottons(these buttons are chioces of fabrics). when one of the panning buttons is pressed it gives a variable “choice:String” a value,ie brown fabric,blue fabric

i had a possible solution in the following but it doesnt work.Dont know if its just error in the syntax or what

if (choice = “”){  
this.onMouseMove = function(){  
constrainedMove(bg\_mc, 4, 0)  
};  
}

Thanks any help is valued

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [July 10, 2008, 3:41pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/4 "2008-07-10T15:41:19Z")

</div>

> i had a possible solution in the following but it doesnt work.Dont know if its just error in the syntax or what

Well, if you look at the tutorial code, you’ll notice that it also creates the _onEnterFrame_ handler, and that is actually what moves the image around. You would need code like:

```auto
my_mc.onEnterFrame = null

```

…somewhere so that the background stops moving.

---

<div class="post-metadata">

**Author:** ![Flashr](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@Flashr](https://forum.kirupa.com/u/Flashr)\
**Post date:** [July 10, 2008, 4:22pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/5 "2008-07-10T16:22:07Z")

</div>

> my\_mc.onEnterFrame = null

ok where would that code go …on the button release event?  
This is the code so far in the panning buttons

```auto
on (release) {
	_root.choice = "Choice 1";//e.g."Choice 2" on the second panning button
	_root.bagchoice.text = "Choice 1";// a label showing what selection they have made		
}

```

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [July 10, 2008, 4:24pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/6 "2008-07-10T16:24:33Z")

</div>

Well, I don’t really know the position of your buttons relative to the image pan MovieClip, but I’m guessing that something like this would work:

```auto
on (release) {
	_root.choice = "Choice 1";//e.g."Choice 2" on the second panning button
	_root.bagchoice.text = "Choice 1";// a label showing what selection they have made		
	_root.my_mc.onEnterFrame = null;
}

```

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [July 10, 2008, 4:25pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/7 "2008-07-10T16:25:22Z")

</div>

the tag’s [noparse]

```auto

```

[/noparse] Flashr 😉

---

<div class="post-metadata">

**Author:** ![graylensman](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@graylensman](https://forum.kirupa.com/u/graylensman)\
**Post date:** [July 10, 2008, 5:39pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/8 "2008-07-10T17:39:52Z")

</div>

I’m at work right now. When I get home, I’ll see if I have my example I can post up.

---

<div class="post-metadata">

**Author:** ![Flashr](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@Flashr](https://forum.kirupa.com/u/Flashr)\
**Post date:** [July 10, 2008, 6:51pm UTC](https://forum.kirupa.com/t/need-help-with-interactive-image-panning-tuorial/265568/9 "2008-07-10T18:51:11Z")

</div>

Tried that but didnt work…no erors just thingy caried on moving.

Is this not because the function

```auto
this.onMouseMove = function(){ 
constrainedMove(bg_mc, 4, 0) 
};

```

is a mouse move so it intiaites practicly always.?dont know still new to AS but how i understand it is that the above function is the one that Starts the whole thing.so thats where it posiibly needs to be stoped.yes? no?

Thanks for the help again guys.

\>greylensman : that would be great thanks.think i may reconsider the pan on mouse move to when a button is pressed,but would love to sort this out for future
