I'm building a website with several menu options. I use thumbnail panel scroll examples and modified it to achieve what I want to do. Loading dynamically each photography items.
Ex: Book 1 ==> Loading 5 images Book 2 ==> Loading 2 images ...
As matter of fact, when clicking Book 1 the total width is larger than Book 2.
The problem is I want to put a limit at the last photo item to stop scrolling further. It seems that my container.panelMC.width is overwritten the last variable all the time. How can I reset it each time which loading different photo gallery?
However Adding the limit in first image index is working fine.
private function handleScroll(event:Event):void
{
var xSpeed = 0;
var thumbX = scrollbarMC.getThumbX();
var thumb = scrollbarMC.getThumbMC();
var trackWidth = scrollbarMC.getTrackMC();
var bounds = container.strokeMC.getBounds(this);
var tempo = 0;
// Verify 4 areas when mouse in Outside of the Panel area defined
if ((stage.mouseX < bounds.x) || (stage.mouseX > bounds.width) || (stage.mouseY < stage.stageHeight - HEIGHT) || (stage.mouseY > bounds.height)) {
// Reinstate mouseOver, make sure not to run when outside of panel
container.panelMC.addEventListener(MouseEvent.MOUSE_OVER, handleTestScroll);
container.panelMC.removeEventListener(Event.ENTER_FRAME, handleScroll);
} else {
// Get the speed distance of X axis
xSpeed = -(stage.mouseX - middle) / SPEED;
tempo = container.panelMC.width;
trace("****Panel Width: "+tempo);
// From middle stage, verify when mouse is oriented to right side of stage
if (stage.mouseX > middle) {
trace('__Scrolling Right side...');
// Add a limit at LAST image index in panel to stop scrolling further
if (container.panelMC.x >= (stage.stageWidth - tempo))
container.panelMC.x += xSpeed;
} else {
trace('__Scrolling Left side: '+stage.x);
// Add a limit at FIRST image index of container to stop scrolling further
if (container.panelMC.x < stage.x)
container.panelMC.x += xSpeed;
}
}
}