Skip to content

Instantly share code, notes, and snippets.

@jonathantorres
Created February 17, 2010 01:23
Show Gist options
  • Save jonathantorres/306168 to your computer and use it in GitHub Desktop.
Save jonathantorres/306168 to your computer and use it in GitHub Desktop.
public function BrowserGallery(xmlString:String)
{
pictures = new MovieClip();
addChild(pictures);
imgContainer = new MovieClip();
pictures.addChild(imgContainer);
imgContainer.addChild(imgLoader);
//CREATES ARROWS FOR EACH IMAGE ON THE GALLERY, TO MOVE TO THE NEXT OR THE PREVIOUS ONE
arrowRight = new MovieClip();
arrowRight.graphics.lineStyle(2, 0xFFFFFF, 1.0);
arrowRight.graphics.moveTo(0, 0);
arrowRight.graphics.lineTo(15, 15);
arrowRight.graphics.lineTo(0, 30);
arrowRightSquare = new MovieClip();
arrowRightSquare.graphics.beginFill(0x000000, 0.8);
arrowRightSquare.graphics.drawRect(0, 0, 40, 40);
arrowRightSquare.graphics.endFill();
arrowRightSquare.buttonMode = true;
arrowLeft = new MovieClip();
arrowLeft.graphics.lineStyle(2, 0xFFFFFF, 1.0);
arrowLeft.graphics.moveTo(0, 0);
arrowLeft.graphics.lineTo(15, 15);
arrowLeft.graphics.lineTo(0, 30);
arrowLeft.rotation = 180;
arrowLeftSquare = new MovieClip();
arrowLeftSquare.graphics.beginFill(0x000000, 0.8);
arrowLeftSquare.graphics.drawRect(0, 0, 40, 40);
arrowLeftSquare.graphics.endFill();
arrowLeftSquare.buttonMode = true;
//LOADS THE XML PASSED IN THE CONSTRUCTOR BROWSER GALLERY - BrowserGallery(xmlString:String)
xml = new XML();
xmlURL = new URLRequest(xmlString);
xmlLoader = new URLLoader(xmlURL);
//EVENT LISTENERS TO THE XML, PICTURES MOVIE CLIP AND THE ARROWS
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
pictures.addEventListener(MouseEvent.ROLL_OVER, displayArrows);
pictures.addEventListener(MouseEvent.ROLL_OUT, hideArrows);
arrowLeftSquare.addEventListener(MouseEvent.CLICK, prevImage);
arrowRightSquare.addEventListener(MouseEvent.CLICK, nextImage);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment