# XML- wait until SWF ends

**URL:** <https://forum.kirupa.com/t/xml-wait-until-swf-ends/181726>\
**Category:** flash\
**Created:** [March 12, 2006, 12:19pm UTC](https://forum.kirupa.com/t/xml-wait-until-swf-ends/181726 "2006-03-12T12:19:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jt\_01](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Jt\_01](https://forum.kirupa.com/u/Jt_01)\
**Post date:** [March 12, 2006, 12:19pm UTC](https://forum.kirupa.com/t/xml-wait-until-swf-ends/181726/1 "2006-03-12T12:19:02Z")

</div>

Hi, I have this code below, what it is trying to do is load a series of swfs in a slideshow automatically, but it needs to wait until the currently loaded swf has stopped playing before it goes on to then next one. I am testing this through checking its currentframe over its totalframes but it doesn’t seem to work that well. Can anyone help?

Thanks!

```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;
            totalSlides = rootNode.childNodes.length;
            firstSlideNode = rootNode.firstChild;
            currentSlideNode = firstSlideNode;
            currentIndex = 1;
            updateSlide(firstSlideNode);
    }
}
// Updates the current slide with new image and text 
function updateSlide(newSlideNode) {
    imagePath = newSlideNode.attributes.jpegURL;
    slideText = newSlideNode.firstChild.nodeValue;
    loadMovie(imagePath, targetclip.holder);
}
// Event handler for 'Next slide' button
next_btn.onRelease = function() {
    nextSlideNode = currentSlideNode.nextSibling;
    if (nextSlideNode == null) {
        break;
    } else {
        if(targetclip.holder._currentframe>=targetclip.holder._totalframes){
        currentIndex++;
        updateSlide(nextSlideNode);
        currentSlideNode = nextSlideNode;
    }}
};
// Event handler for 'Previous slide' button
back_btn.onRelease = function() {
    previousSlideNode = currentSlideNode.previousSibling;
    if (previousSlideNode == null) {
        break;
    } else {
        currentIndex--;
        currentSlideNode = previousSlideNode;
        updateSlide(previousSlideNode);
    }
};
loader = function() {
            if(targetclip.holder._currentframe>=targetclip.holder._totalframes){
//
targetclip.movie.gotoAndPlay("in");
//
            nextSlideNode = currentSlideNode.nextSibling;
    if (nextSlideNode == null) {
        break;
    } else {
        currentIndex++;
        updateSlide(nextSlideNode);
        currentSlideNode = nextSlideNode;
            }}
}
setInterval(loader, 1000);

```
