Photogallery XML example question

Hey there,

I am currently exploring the possibilities in XML and found this photogallery XML example to be used in Flash. I understand most things about it, only I am trying to add the following stuff to the XML and the actionscriptcode :

  • there is <image> and <caption> ; but I would like to add 4 more elements, and just as caption they are supposed to be text nodes. Adding this in the XML file is not so hard ofcourse, but getting them to work in the existing XML photogallery XML is harder, in fact I cant get it to work

  • also last but not least I would like an element such as <download> to be added to each childnode that contains an URL. Inside the flashmovie everytime a new file gets displayed I would like the download button to receive that url (so every file uses the same button, but sends in a different url for it).

The current Photogallerycode is like this :


function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
firstImage();

} else {

content = "file not loaded!";

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.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();
loaded = picture.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;

}

}

};
function nextImage() {

if (p<(total-1)) {

p++;
if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[p], 1);
text1_txt.text = description[p];
picture_num();

}

}

}
function prevImage() {

if (p>0) {

p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
text1_txt.text = description[p];
picture_num();

}

}
function firstImage() {

if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[0], 1);
text_1.text = description[0];
picture_num();

}

}
function picture_num() {

current_pos = p+1;
pos_txt.text = current_pos+" / "+total;

}

so as you can see its like the original from the example. I am trying to understand the XML thing and it seems to me that the <caption> text node is being pushed in the description array. Aside from the fact that I prefer a different name for the caption thing, if I add more elements that contain text nodes in the XML file, do they get put in the description array too ?

And how do I specify each element to a different dynamic textbox ?
I would like to maintain the basics of the current photogallery code as its very useful for me to preview the files I would like people to be able to download from my site. I just need to specify more information in different textboxes and I want to assign an url to a download button each time a new file gets displayed.

If it helps I could post my flash file and the XML file I would like to use.

Thanks in advance!