Skip to content

Instantly share code, notes, and snippets.

@jonathantorres
Created February 17, 2010 01:29
Show Gist options
  • Save jonathantorres/306177 to your computer and use it in GitHub Desktop.
Save jonathantorres/306177 to your computer and use it in GitHub Desktop.
private function nextImage(mouseEvent:MouseEvent):void
{
//WHEN YOU CLICK TO THE NEXT IMAGE ARROW, REMOVES THE CURRENT IMAGE, AND LOADS THE NEXT IMAGE IN THE xml.image TAG BY ADDING 1 TO THE currentImg VARIABLE, IF currentImg EQUALS THE VALUE OF lastImg IT SETS ITS VALUE TO 0 (TO GO TO THE FIRST IMAGE ON THE GALLERY (TO START OVER), ALL THIS IS DONE WITH THE CONDITIONAL. ALSO PLACES THE ARROWS IN PLACE AGAIN FOR THE NEXT IMAGE LOADED.
imgLoader.unload();
currentImg = (currentImg < lastImg) ? currentImg + 1 : 0;
loadImages();
arrowRightSquare.x = 20;
arrowRightSquare.y = imgLoader.height / 2 - 40;
arrowLeftSquare.x = -20;
arrowLeftSquare.y = imgLoader.height / 2 - 40;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment