Join Login


Video Tutorials
Blog



Stock Photos from 123RF

Create an Image Gallery with Enlarging Thumbnails


By: RiverCityGraphix      Views: 20120      Share: Bookmark and Share

In this tutorial, you will learn how to create an image gallery with enlarging thumbnails in Flash CS5.

I have made a number of image galleries throughout my time making tutorials. Most of my galleries only support a few images. This gallery can support many images because you can make many small tiles of images across the stage and then expand them upon click. By allowing your users to expand an image you can save space, while allowing the image to be displayed as large as you would like. This Flash tutorial was actually suggested by a viewer. If you have a suggestion for a gallery or other tutorial, please post it on the forums. Good luck with your enlarging thumbnail gallery in Flash!

Actionscript 3.0 (AS3) Code for Main Stage

stop();

btn1.addEventListener(MouseEvent.CLICK, loadimage1);
btn2.addEventListener(MouseEvent.CLICK, loadimage2);
btn3.addEventListener(MouseEvent.CLICK, loadimage3);
btn4.addEventListener(MouseEvent.CLICK, loadimage4);

function loadimage1 (event:MouseEvent):void{
imagetxt.text = "a";
togglewindow.gotoAndPlay(2);
}

function loadimage2 (event:MouseEvent):void{
imagetxt.text = "b";
togglewindow.gotoAndPlay(2);
}

function loadimage3 (event:MouseEvent):void{
imagetxt.text = "c";
togglewindow.gotoAndPlay(2);
}

function loadimage4 (event:MouseEvent):void{
imagetxt.text = "d";
togglewindow.gotoAndPlay(2);
}


Actionscript 3.0 (AS3) Code for Frame 1 of togglewindow MovieClip

stop();


Actionscript 3.0 (AS3) Code for Frame 12 of togglewindow MovieClip

stop();

close_btn.addEventListener(MouseEvent.CLICK, closetoggle);

function closetoggle(event:MouseEvent):void{
gotoAndPlay(12);
}

////////////////////////Image 1////////////////////////

if(MovieClip(this.parent).imagetxt.text == "a"){
var imgurl:String = "C:/Users/Kevin/Desktop/Images/boat.jpg";
var myrequest:URLRequest = new URLRequest(imgurl);
myloader.scaleContent = true;
myloader.load(myrequest);
}
/////////////////////////////////////////////////////////////////////////
else if(MovieClip(this.parent).imagetxt.text == "b"){
var imgurl2:String = "C:/Users/Kevin/Desktop/Images/flowers.jpg";
var myrequest2:URLRequest = new URLRequest(imgurl2);
myloader.scaleContent = true;
myloader.load(myrequest2);
}
/////////////////////////////////////////////////////////////////////////
else if(MovieClip(this.parent).imagetxt.text == "c"){
var imgurl3:String = "C:/Users/Kevin/Desktop/Images/mountains.jpg";
var myrequest3:URLRequest = new URLRequest(imgurl3);
myloader.scaleContent = true;
myloader.load(myrequest3);
}
/////////////////////////////////////////////////////////////////////////
else if(MovieClip(this.parent).imagetxt.text == "d"){
var imgurl4:String = "C:/Users/Kevin/Desktop/Images/trees.jpg";
var myrequest4:URLRequest = new URLRequest(imgurl4);
myloader.scaleContent = true;
myloader.load(myrequest4);
}




Free Source Files Zip

Host Unlimited Domains on 1 Account