Hey everyone! I didn’t know that figuring this out would take so long, but I finally realized I have to bring it up.
I have a slideshow that plays from an XML file and I need it to loop to the first image when it reaches the end. This is the code I have:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
//declare image and description as array
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
//image* will store value from the inner tag <image>XXXX</image>
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
//description* will store value from the inner tag <caption>XXXX</caption>
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content.text = "file not loaded!";
}
}
xmlAlbum = new XML();
xmlAlbum.ignoreWhite = true;
xmlAlbum.onLoad = loadXML;
xmlAlbum.load("album.xml");
p=0;
function nextImage() {
if (p<(total-1)) {
p++;
photo_mc.loadPhoto(image[p]);
content.text = description[p];
}
}
function prevImage() {
if (p>0) {
p--;
photo_mc.loadPhoto(image[p]);
content.text = description[p];
}
}
function firstImage() {
photo_mc.loadPhoto(image[0]);
content.text = description[0];
}
I really would appreciate the help. I’ve searched the web, but I haven’t found anything that is in Flash MX or that uses a similar code. Thank you so much all.
-SD
PS- I still need help with a topic I posted a week or so ago and still have no replies if you can check it out. Thanks!