One thing that I have always been thankful for was the great people who help keep the site's content fresh and engaging. More often than not, I have often been inspired to write a tutorial based on a user's post on the forum. This tutorial is no exception. This tutorial would not be possible without the help of the great moderator sbeener (suprabeener in the old forums). He was more than kind enough to share a more efficient version of a photo gallery that I created, and his version is what you will be duly pleased with at the end of completing this tutorial.
Use your arrow keys or press the green left and right arrows in the following animation to navigate through the photo gallery:
[ use your arrow keys or click on the green arrows to move through the gallery]
You will create something similar to the above animation in a short while.
Creating a Photo Gallery:

[ the convert to symbol dialog box ]

[ give the mc the name 'photo' in the instance panel ]
[ add the above lines of code to the empty keyframe ]
Customizing the Photo Gallery Code
Now here comes the relatively simple part of
customizing the code to work with your own pictures to make
your photo gallery something more meaningful than 10
pictures of wildlife I found over at the National Geographic
site. Make sure your Actions dialog box is displayed with
the code you pasted and read on!
More than likely, you have your images stored in a certain location on your Web site or on your hard drive that is different from where your Flash animation is stored.
Find the first line of code (it is a variable actually) that says: this.pathToPics. Modify the path set by the aforementioned variable to the folder containing your images. For example, in the version of the code in the tutorial, the images are stored in the animation folder. Therefore, the variables pathToPics equals "animation/". If your images are stored in the SAME directory as your animation, simply make pathToPics equal "" as in:
this.pathToPics = "animation/";
Other examples of how you can modify the code include:
this.pathToPics = "../animation/";
this.pathToPics = "http://www.kirupa.com/pics/";
Now, you get the chance to specify the file name for the images that will be used! Find the line that says this.pArray. Replace all the image names I have written with the images that you will use instead. If you have more images than spaces provided, simply add more image names by adding a comma with the image name in quotation marks.
The code for just two images would be:
this.pArray = ["flash.jpg", "windows.jpg"];
Again, you can have as many or as few images in the photo gallery. The code that sbeener wrote is intelligent enough to count the number of images you specify in the pArray variable and customize the gallery accordingly.
You are done with customizing the code and this tutorial (for the second time). Preview the animation and see how it works. If you are good with ActionScript, you can tweak the code with a few modifications of your own.
Creating the Back and Forward Buttons
You have finished everything except the Back
and Forward buttons. While this is optional, it is always
nice to provide users a way of navigating your photo gallery
without having to use the back and forward keys. To create
the back and forward buttons, try the following steps:
Rejoice! You have just completed your photo gallery tutorial (again) with the next and forward buttons.
| the loaded images look disproportionate | ||
|
||
The above note concluded this tutorial. If
you get a chance, drop by the forums (http://www.kirupaforum.com)
and thank sbeener for the great code. If you are
interested in viewing my FLA with the images, click the
download FLA link below:
|
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

:: Copyright KIRUPA 2026 //--