PDA

View Full Version : XML Slideshow Loop


drustar
05-31-2004, 12:42 AM
I am simply hacking the XML slideshow provided by Macromedia.

You can follow/download the source files here. http://www.macromedia.com/support/flash/applications/jpeg_slideshow_xml/index.html.

I've inserted the following code on the very last line:

myImg = setInterval(imgLoop, 5.5*1000);
function imgLoop() {
nextSlideNode = currentSlideNode.nextSibling;
if (currentIndex>=totalSlides) {
currentIndex = 1;
updateSlide(firstChildNode);
} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
}

The first run plays the slideshow accordingly. The problem is the 2nd time around, only the first image shows up and the rest are undefined. What am I doing wrong? Any help would be appreciated.

drustar
05-31-2004, 01:19 PM
myImg = setInterval(test, 1*1000);
function test() {
if (currentIndex>=totalSlides or nextSlideNode == totalSlides+1) {
currentIndex = 1;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
updateSlide(firstSlideNode);
} else {
nextSlideNode = currentSlideNode.nextSibling;
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
}

Yay for XML and Actionscripting.