Skip to content

Instantly share code, notes, and snippets.

@jonathantorres
Created February 4, 2010 20:49
Show Gist options
  • Save jonathantorres/295086 to your computer and use it in GitHub Desktop.
Save jonathantorres/295086 to your computer and use it in GitHub Desktop.
public function JThumbnail(img:String, link:String, name:String) {
image = new URLRequest(img);
imgLink = link;
imgName = name;
thumb = new MovieClip();
thumb.buttonMode = true;
addChild(thumb);
thumbShadow = new GlowFilter(0x666666, 0.4, 15, 15);
thumb.filters = [thumbShadow];
imgLoader = new Loader();
imgLoader.load(image);
thumb.addChild(imgLoader);
overShape = new Sprite();
overShape.graphics.beginFill(0x000000, 0.5);
overShape.graphics.drawRect(0, 0, 150, 150);
overShape.graphics.endFill();
overShape.buttonMode = true;
overInvisibleShape = new Sprite();
overInvisibleShape.graphics.beginFill(0x000000, 0);
overInvisibleShape.graphics.drawRect(0, 0, 150, 150);
overInvisibleShape.graphics.endFill();
overInvisibleShape.buttonMode = true;
thumb.addChild(overShape);
overShape.alpha = 0;
imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadThumb);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb.addEventListener(MouseEvent.ROLL_OVER, overThumb);
thumb.addEventListener(MouseEvent.ROLL_OUT, outThumb);
thumb.addEventListener(MouseEvent.CLICK, clickThumb);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment