# 180 degree pan on mouse over - stop in place on mouse out

**URL:** <https://forum.kirupa.com/t/180-degree-pan-on-mouse-over-stop-in-place-on-mouse-out/236842>\
**Category:** flash\
**Created:** [August 24, 2007, 3:05am UTC](https://forum.kirupa.com/t/180-degree-pan-on-mouse-over-stop-in-place-on-mouse-out/236842 "2007-08-24T03:05:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![njacobson](https://avatars.discourse-cdn.com/v4/letter/n/439d5e/32.png) [@njacobson](https://forum.kirupa.com/u/njacobson)\
**Post date:** [August 24, 2007, 3:05am UTC](https://forum.kirupa.com/t/180-degree-pan-on-mouse-over-stop-in-place-on-mouse-out/236842/1 "2007-08-24T03:05:55Z")

</div>

I want to do something similar to these except I would like to have left and right arrow buttons that pan on rollOver and stop in place on rollOut.

[http://www.kirupa.com/developer/flash8/interactive\_image\_pan.htm](http://www.kirupa.com/developer/flash8/interactive_image_pan.htm)  
[http://www.flashloaded.com/flashcomponents/360panviewer/](http://www.flashloaded.com/flashcomponents/360panviewer/)

I was able to get it to pan on mouseover correctly, but mouseout seems to moving the mc to -3830. Here’s my code

//code on panning\_mc  
onClipEvent(load){  
\_root.targetx = -3830; //Startposition  
}  
onClipEvent(enterFrame){  
diff = \_root.targetx - this.\_x;  
this.\_x += diff/50;  
}

//code on left button  
on(rollOver){  
\_root.targetx = 50;  
}  
on(rollOut){  
\_root.targetx = panoramic\_mc.\_x;  
}

//code on right button  
on(rollOver){  
\_root.targetx = -50;  
}  
on(rollOut){  
\_root.targetx = panoramic\_mc.\_x;  
}

Can anyone help?
