# Want to load 2 images in the xml flash slideshow

**URL:** <https://forum.kirupa.com/t/want-to-load-2-images-in-the-xml-flash-slideshow/204260>\
**Category:** Uncategorized\
**Created:** [October 18, 2006, 1:45pm UTC](https://forum.kirupa.com/t/want-to-load-2-images-in-the-xml-flash-slideshow/204260 "2006-10-18T13:45:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![33yellowducks](https://avatars.discourse-cdn.com/v4/letter/3/2acd7d/32.png) [@33yellowducks](https://forum.kirupa.com/u/33yellowducks)\
**Post date:** [October 18, 2006, 1:45pm UTC](https://forum.kirupa.com/t/want-to-load-2-images-in-the-xml-flash-slideshow/204260/1 "2006-10-18T13:45:50Z")

</div>

Hi there

I have the following tutorial

> **[XML Slideshow/PhotoGallery - Hyperlinking Each Image](https://www.kirupa.com/forum/showthread.php?t=81020)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

it loads the images and text from xml. I need this to load in two images simultaneously, 1 picture and 2 the color bar over it… becuase each slide needs to have its own color.

I added a node in the xml file shown in red here.

\<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?\>  
\<images\>  
\<pic\>  
[COLOR=“Black”]\<image\>images/image1.jpg\</image\>  
\<caption\>One\</caption\>  
[COLOR=“black”][COLOR=“Red”]\<labels\>images/a.png\</labels\>[/COLOR][/COLOR]  
[COLOR=“Black”][COLOR=“Red”][COLOR=“black”]\<link\>[http://www.yahoo.com](http://www.yahoo.com)[/COLOR]\</link\>[/COLOR][/COLOR]  
\</pic\>  
[/COLOR] \<pic\>  
\<image\>images/image2.jpg\</image\>  
\<caption\>Two\</caption\>  
[COLOR=“red”]\<labels\>images/b.png\</labels\>[/COLOR]  
\<link\>[http://www.google.com](http://www.google.com)\</link\>  
\</pic\>

```
    &lt;/images&gt;

```

In the Action script i added the instance of the color bar like so. shown in red … and added a lyer in flash with a movie clip with instance name color. It works for the first skide but in the next or previous the second omage of color bar doesnt get loaded.

Please help…

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
description = [];  
[COLOR=“Red”]labels = [];[/COLOR]  
//  
//define link variable  
//  
link = [];  
//  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
[COLOR=“red”]labels\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;  
[/COLOR] //  
//adding links  
//  
link\* = xmlNode.childNodes\*.childNodes[3].firstChild.nodeValue;  
//  
}  
firstImage();  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“image\_and\_link.xml”);  
/////////////////////////////////////  
listen = new Object();  
listen.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
prevImage();  
} else if (Key.getCode() == Key.RIGHT) {  
nextImage();  
}  
};  
Key.addListener(listen);  
previous\_btn.onRelease = function() {  
prevImage();  
};  
next\_btn.onRelease = function() {  
nextImage();  
};  
/////////////////////////////////////  
p = 0;  
this.onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
filesize = color.getBytesTotal();  
loaded = picture.getBytesLoaded();  
loaded = color.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
} else {  
preloader.\_visible = false;  
if (picture.\_alpha\<100) {  
picture.\_alpha += 10;  
}  
[COLOR=“Red”]if (color.\_alpha\<100) {  
[COLOR=“red”]color.\_alpha += 10;  
[/COLOR] }  
[/COLOR] }  
//  
//getURL statement  
//  
picture.onRelease = function() {  
getURL(link[p], “\_blank”);  
};  
//  
};  
function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
[COLOR=“Red”]color.\_alpha = 0;  
color.loadMovie(image[p], 2);  
[/COLOR] picture\_num();  
}  
}  
}  
function prevImage() {  
if (p\>0) {  
p–;  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
[COLOR=“Red”]color.\_alpha = 0;  
color.loadMovie(image[p], 1);  
[/COLOR] picture\_num();  
}  
}  
function firstImage() {  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[0], 1);  
[COLOR=“Red”]color.\_alpha = 0;  
color.loadMovie(labels[0], 1);[/COLOR]  
desc\_txt.text = description[0];  
picture\_num();  
}  
}
