# Newbie needing help with a horizontal image gallery scroller

**URL:** <https://forum.kirupa.com/t/newbie-needing-help-with-a-horizontal-image-gallery-scroller/301600>\
**Category:** flash\
**Created:** [December 11, 2009, 10:09pm UTC](https://forum.kirupa.com/t/newbie-needing-help-with-a-horizontal-image-gallery-scroller/301600 "2009-12-11T22:09:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![OhCaye](https://avatars.discourse-cdn.com/v4/letter/o/47e85d/32.png) [@OhCaye](https://forum.kirupa.com/u/OhCaye)\
**Post date:** [December 11, 2009, 10:09pm UTC](https://forum.kirupa.com/t/newbie-needing-help-with-a-horizontal-image-gallery-scroller/301600/1 "2009-12-11T22:09:53Z")

</div>

Can I please ask for help looking at the following code’s kinks worked out? We are trying to get a set of five buttons to glide from left to right depending on the mouse’s position within the borders of a mask. Relevant instance names are panel1 (the movie clip of buttons), mask\_mc (the mask that hides the overflow).

Nothing is happening when I move the mouse over any part of the mask\_mc. I have combed through this code and I am not getting any errors, but I definitely don’t have a mathematical mind.

mask\_mc.addEventListener(MouseEvent.MOUSE\_MOVE, panelMover);  
var myLoader:Loader=new Loader ();  
preloader.visible=false;  
stroke.alpha=0;  
var speed:Number;  
var padding:Number=0;

function panelMover(event:MouseEvent):void {  
if (mouseY\>mask\_mc.y&&mouseY\<mask\_mc.height) {//vertically over scroller  
if (mouseX\<mask\_mc.x&&mouseX\>mask\_mc.width+mask\_mc.x) {//outside of mask explicitly  
speed = 0;  
} else if (mouseX \> mask\_mc.x+mask\_mc.width/2 && mouseX \< mask\_mc.width+mask\_mc.x) {//right of stage explicitly  
speed = -(mouseX - (mask\_mc.width/2 )) / 7;  
} else if (mouseX \> mask\_mc.x && mouseX \< mask\_mc.x+mask\_mc.width/2) {  
speed = +(mouseX - (mask\_mc.width/2)) / 7;  
}  
panel1.x+=speed;  
}  
}

Thank you so much for any help!

Caye
