-
Mouse_over
I'm working on a script that is about finished but I've reached a snag. I'm creating a gallery page, similar to Thickbox or Lightbox.
I have thumbnails off to the left and a UILoader on the right. When you click a thumbnail, the image loads on the left. Easy!
What I'm working on now is that if you hover over the right side of the image you get a NextBtn and on the left you'd get a PrevBtn.
The buttons are created and tween in on MOUSE_OVER like they are supposed to. The problem that I'm having is once you MOUSE_DOWN and the next image loads (also working properly) the Tween that is on the Prev/NextBtns resets to the OUT position until you mouse outside the rollover than back in. Is there any way to make the Tween stay IN until the mouse moves out?
excerpt from code:
prevOver.addEventListener(MouseEvent.MOUSE_OVER, activatePrevBtn);
nextOver.addEventListener(MouseEvent.MOUSE_OVER, activateNextBtn);
prevOver.addEventListener(MouseEvent.MOUSE_OUT, deactivatePrevBtn);
nextOver.addEventListener(MouseEvent.MOUSE_OUT, deactivateNextBtn);
prevOver.addEventListener(MouseEvent.MOUSE_DOWN, clickPrev);
nextOver.addEventListener(MouseEvent.MOUSE_DOWN, clickNext);
nextBtn.addEventListener(MouseEvent.MOUSE_DOWN, clickNext);
prevBtn.addEventListener(MouseEvent.MOUSE_DOWN, clickPrev);
function activatePrevBtn(e:MouseEvent):void{
tweenPrevIn()
}
function activateNextBtn(e:MouseEvent):void{
tweenNextIn()
}
function deactivatePrevBtn(e:MouseEvent):void{
tweenPrevOut()
}
function deactivateNextBtn(e:MouseEvent):void{
tweenNextOut()
}
function clickNext(e:MouseEvent):void{
switch (currentImg) {
case 1:
mainLoader.ImageLoader.source="images/product/img2.jpg";
currentImg = 2;
break;
case 2:
mainLoader.ImageLoader.source="images/product/img3.jpg";
currentImg = 3;
break;
}
}
-
And the next and prev buttons are not part of the main image loader. I've run into this problem before, but I don't recall exactly what I did to correct it. Are your prev and next buttons actual buttons or movieclips?
-
Buttons
The previous and next buttons are actually buttons not mc. There are actually "2" of each. There is a nextOver and a nextBtn, same for prev. They are all buttons, the Over are invisible, just used to apply a "hit" area. The Btn is a visible button that tweens in on rollover of the Over.
For what its worth, the reason for the "hit" area is because it rescales to match the 1/2 size of the image that is currently in the Loader.
I get the feeling that it is something simple that I'm missing. I can post the fla if it would be helpful.