Setinterval(loop,stop) problem

Hi there,

I added a setinterval function to my slideshow.Prob is when the slideshow reaches the last pic it returns to pic1 goes to pic2,… but after the second loop it starts mixing the wrong pics for the wrong number.I guess I did a mistake in the if statement(if (nextSlideNode == null)…). can someone solve this for me.

See following code below. Also how can I stop this animation. I did something like clearinterval(advance); but that did not do the trick. Any help would be appreciated.Grtz

setInterval(advance, 5000);
function advance(nextSlideNode) {
nextSlideNode = currentSlideNode.nextSibling;

if (nextSlideNode == null) { //this should make the loop
updateSlide(firstSlideNode);
rootNode = slides_xml.firstChild;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
firstSlideNode = firstSlideNode.nextSibling;
currentIndex = 1;
} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
}

try this-
if (nextSlideNode == null || nextSlideNode == undefined)

If this is the code to get the loop working it didn’t do the trick:(.
And how perform a stop off the autoplay?

Grtz,

For the stop, give the setInterval an id:

stopID=setInterval(advance, 5000);

and on your stop button

 stopButton.onRelease = function(){
clearInterval(stopID);
}

scotty(-:

Your the man scotty!!! Now for my loop problem you see something wrong in this if statement:

if (nextSlideNode == null) {
updateSlide(firstSlideNode);
rootNode = slides_xml.firstChild;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
firstSlideNode = firstSlideNode.nextSibling;
currentIndex = 1;

And if I won’t to control the speed of the interval like with a plus and minus button how do this?

Grtz,

Hard to say without a fla. I don’t think it’s in the first part of the if statement (this will only run when nextSlideNode == null).
I guess it has to do with the “currentIndex++;”:q:

scotty(-:

Hey Scotty I’ve send you a pm.
Grtz,

modulater, check your pm;)

scotty(-: