# Please! Scrolling Image Gallery Problems

**URL:** https://forum.kirupa.com/t/please-scrolling-image-gallery-problems/279894
**Category:** flash
**Created:** [January 20, 2009, 2:31pm UTC](https://forum.kirupa.com/t/please-scrolling-image-gallery-problems/279894 "2009-01-20T14:31:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jjdelv](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jjdelv](https://forum.kirupa.com/u/jjdelv)
#### Post date: [January 20, 2009, 2:31pm UTC](https://forum.kirupa.com/t/please-scrolling-image-gallery-problems/279894/1 "2009-01-20T14:31:43Z")

</div>

I am going mad here… I am pretty new to AS3 and I am ad-libbing the code to create a scrolling image gallery as seen when you click ‘new panel’ here: [http://www.noponies.com/dev/as3\_scrollingpanel/](http://www.noponies.com/dev/as3_scrollingpanel/)

How he set that up was WAY too complicated for me so I am trying to simplify it to my knowledge.

Let me explain my problem…

I have managed to ensure that by clicking the left and right buttons my panel scrolls a certain amount of pixels at a time, and when it reaches the end of the panel I have put in an eventListener to ensure that the button won’t click anymore. So far so good. The problem is that if I have gone all the way to the right edge of the panel and start going back towards the left I can’t go right again because the button no longer lets me click it.

(another problem I am having is that if I click the button before the tween has finished it throws off my co-ordinates - is there any way to deactivate the button for around 2 seconds so that doesn’t happen?)

I’m on a really tight deadline so I would be eternally grateful if someone could help me… i don’t know who else to ask!

Here is my code for a better idea:

stop();  
import gs.TweenLite;  
import fl.motion.easing.\*;

leftArrow.addEventListener(MouseEvent.CLICK, leftClick)  
rightArrow.addEventListener(MouseEvent.CLICK, rightClick)

function leftClick(event:MouseEvent):void {  
TweenLite.to(panel, 1, {x:“299”});  
if(panel.x \>= -300)  
leftArrow.removeEventListener(MouseEvent.CLICK, leftClick)

}

function rightClick(event:MouseEvent):void {  
TweenLite.to(panel, 1, {x:"-299"});  
if(panel.x \<= -2900)  
rightArrow.removeEventListener(MouseEvent.CLICK, rightClick)  
}
