Kirupa's Flash MX Photo Gallery

I’m using Kirupa’s Flash MX Photo Gallery located at

When the script calls the images it’s going to use, it says:
[indent]// fill this array with your pics
this.pArray = [“image0.jpg”, “image1.jpg”, “image2.jpg”, “image3.jpg”, “image4.jpg”, “image5.jpg”, “image6.jpg”, “image7.jpg”, “image8.jpg”, “image9.jpg”];
How can I call these images’ names from a simple external text file?

Purpose: I want to have the ability to change the photos in the gallery quickly without tweaking the Flash file.

Any help is greatly, greatly appreciated. I’ve wasted so much time already. Thank you.

u can add variables to your external txt file like,
image0 = “rose.jpg”&image1 = “car.jpg”&image2 = “girl.jpg” …

and you can change the array to;

this.pArray = [image0,image1,image2];

In an external textfile, place this:


Then in Flash, you can use this code to load the names to an array:

 theArray = new Array();
 lv = new LoadVars();
 lv.onLoad = function(ok){
 theArray = this.images.split("|");
 trace("Error loading the file - please check the path");

Later on you can then set this.pArray equal to theArray, or immediately load to pArray, as you desire.

King Bert,

Thank you for your help! It works perfectly except for one problem.

Problem: The photo gallery doesn’t appear until you press the forward or backward arrow key. Initially, the target location “photo” has nothing inside of it. Originally, the first photo in the string of images automatically loaded.

To fit your example: “dog.jpg” does not appear as the first picture; nothing does. If I press forward, I see “girl.jpg”. Then, if I press back, I will see “dog.jpg”.

Any ideas…?

Hmn, not sure. Have you tried inputting the same array manually and see what happens then ?

Okay, I got it working by loading manually the first image and being able to change the others dynamically in the txt file.

THANK YOU!! This was my first ever forum experience… a helpful medium for sure!

It should work with loading it all dynamically, but if it works this way then I suppose it’s ok.