# Kirupa's Flash MX Photo Gallery

**URL:** <https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141>\
**Category:** flash\
**Created:** [July 20, 2004, 3:06am UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141 "2004-07-20T03:06:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![grayhassmann](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@grayhassmann](https://forum.kirupa.com/u/grayhassmann)\
**Post date:** [July 20, 2004, 3:06am UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141/1 "2004-07-20T03:06:19Z")

</div>

I’m using Kirupa’s Flash MX Photo Gallery located at [www.kirupa.com/developer/mx/photogallery.htm](http://www.kirupa.com/developer/mx/photogallery.htm).

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”];  
[/indent]  
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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2004, 8:09am UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141/2 "2004-07-20T08:09:50Z")

</div>

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];  
😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2004, 8:22am UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141/3 "2004-07-20T08:22:39Z")

</div>

In an external textfile, place this:

images=dog.jpg|girl.jpg|car.jpg|rose.jpg

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

```auto

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

```

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2004, 4:19pm UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141/4 "2004-07-20T16:19:38Z")

</div>

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…?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2004, 6:10pm UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141/5 "2004-07-20T18:10:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2004, 6:31pm UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141/6 "2004-07-20T18:31:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 11:12am UTC](https://forum.kirupa.com/t/kirupas-flash-mx-photo-gallery/58141/7 "2004-07-21T11:12:49Z")

</div>

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