# Need Help w/ Basic XML Slideshow

**URL:** <https://forum.kirupa.com/t/need-help-w-basic-xml-slideshow/261672>\
**Category:** flash\
**Created:** [May 29, 2008, 6:26pm UTC](https://forum.kirupa.com/t/need-help-w-basic-xml-slideshow/261672 "2008-05-29T18:26:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![msmith29063](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@msmith29063](https://forum.kirupa.com/u/msmith29063)\
**Post date:** [May 29, 2008, 6:26pm UTC](https://forum.kirupa.com/t/need-help-w-basic-xml-slideshow/261672/1 "2008-05-29T18:26:20Z")

</div>

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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![forman](https://avatars.discourse-cdn.com/v4/letter/f/f4b2a3/32.png) [@forman](https://forum.kirupa.com/u/forman)\
**Post date:** [May 29, 2008, 9:04pm UTC](https://forum.kirupa.com/t/need-help-w-basic-xml-slideshow/261672/2 "2008-05-29T21:04:25Z")

</div>

> [@msmith29063;2333175](#):
>
> ```auto
> 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;
> }
> };
> 
> ```

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.

```auto

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.
