Need Help w/ Basic XML Slideshow

Can someone help me with a couple of AS issues in a basic XML slideshow?

Initially, I need to:

  1. Add a pause script where indicated (in seconds)
  2. Have the animation start over when it gets to the last slide

Here’s the existing AS:

slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
slides_xml.ignoreWhite = true;

// Show the first slide and intialize variables
function startSlideShow(success) {
	if (success == true) {
		rootNode = slides_xml.firstChild;
		firstSlideNode = rootNode.firstChild;
		currentSlideNode = firstSlideNode;
		updateSlide(firstSlideNode);
	}
}

// Updates the current slide with new image
function updateSlide(newSlideNode) {
	imagePath = newSlideNode.attributes.fullSlide;
	loadMovie(imagePath, targetClip);
	transitionMC.gotoAndPlay("fadeIn");
}

// Advance slideshow on timer
this.onEnterFrame = function() {
	// *** PAUSE SCRIPT/FUNCTION HERE? ***
	nextSlideNode = currentSlideNode.nextSibling;
	if (nextSlideNode == null) {
		// *** START OVER SCRIPT HERE? ***
		break;
	} else {
		updateSlide(nextSlideNode);
		currentSlideNode = nextSlideNode;
	}
};

Thank you for any help you can provide!

You could have a variable that increments on every call. In doing this, your pause will be relative to the frame rate of your movie. Otherwise from what I see, your startSlideShow function should restart it.


var counter = 0;
this.onEnterFrame = function() {
    if (++counter == 10000){//arbitrary  value used here
         counter = 0  
         nextSlideNode = currentSlideNode.nextSibling;
         if (nextSlideNode == null) {
           starSlideShow(true);
         
         } else {
            updateSlide(nextSlideNode);
            currentSlideNode = nextSlideNode;
         }//end if
    }//end if
}//end onEnterFrame

I hope that I didn’t make any mistakes, and that it works fine.