XML Slideshow - delay timer error

[FONT=Times New Roman][SIZE=3]There seems to be a time delay problem when the slideshow is playing. It will start playing, but as soon as I click on the next or previous button to view another clip it will mess up the delay time and screw up when the pictures will play. Is there a way on how I can fix this … I attached a link to see what is happening. The following script is what I have playing for the images. What should i do …
[/SIZE][/FONT][FONT=Times New Roman][SIZE=3][COLOR=#800080]Slideshow[/COLOR][/SIZE][/FONT]

Here is the fla.

Did you have any luck with your problem?

I am having the same issue. Basically… if you hit the next or back buttons a few times the slideshow freaks out and jumps around. It’s like it throws the timing off or something.

Here’s my code yo:


delay = 10000;
//-----------------------
function loadXML(loaded) {
    if (loaded) {
        xmlNode = this.firstChild;
        image = [];
        description = [];
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
            description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
        }
        firstImage();
    } else {
        content = "file not loaded!";
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
        prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
        nextImage();
    }
};
Key.addListener(listen);
previous_btn.onRelease = function() {
    prevImage();
};
next_btn.onRelease = function() {
    nextImage();
};
////////////////////////////////////////////////
play_btn._visible = 0;
p = 0;
pause_btn.onRelease = function() {
    clearInterval(myInterval);
    pause_btn._visible = 0;
    play_btn._visible = 100;
};
play_btn.onRelease = function() {
    myInterval = setInterval(pause_slideshow, delay);
    pause_btn._visible = 100;
    play_btn._visible = 0;
};
this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
        preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
        preloader._visible = false;
        if (picture._alpha<100) {
            picture._alpha += 10;
        }
    }
};
function nextImage() {
    pause_btn._visible = 100;
    play_btn._visible = 0;
    if (p<(total-1)) {
        p++;
        if (loaded == filesize) {
            picture._alpha = 0;
            picture.loadMovie(image[p], 1);
            desc_txt.text = description[p];
            picture_num();
            slideshow();
        }
    }
}
function prevImage() {
    pause_btn._visible = 100;
    play_btn._visible = 0;
    if (p>0) {
        p--;
        picture._alpha = 0;
        picture.loadMovie(image[p], 1);
        desc_txt.text = description[p];
        picture_num();
    }
}
function firstImage() {
    if (loaded == filesize) {
        picture._alpha = 0;
        picture.loadMovie(image[0], 1);
        desc_txt.text = description[0];
        picture_num();
        slideshow();
    }
}
function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
    rcaption_btn._visible = 100;
    myInterval = setInterval(pause_slideshow, delay);
}
function pause_slideshow() {
    clearInterval(myInterval);
    if (p == (total-1)) {
        p = 0;
        //    firstImage();
    } else if (p == total) {
        gotoAndPlay("credits", 1);
    } else {
        nextImage();
    }
}


I’m still clueless. I’ve attached my slideshow.

I’ve searched this forum and it seems a lot of people have asked about this with no good solutions.

Try change the slideshow function to

function slideshow() {
	clearInterval(myInterval)
	rcaption_btn._visible = 100;
	myInterval = setInterval(pause_slideshow, delay);
}

Thanks for helping! I still seem to have a problem though… When I start the movie it pauses on the second image. I think it is clearing the interval but then not restarting it maybe???

EDIT

I think it’s what I did that is making it not work now. I modified the next & previous functions so that my slideshow would loop and I think that’s what is causing it to hang up. Here’s my code for that:


function  nextImage()  {
    if (p<(total-1)) {
        p++;
        if (loaded == filesize) {
            picture._alpha = 0;
            picture.loadMovie(image[p], 1);
            desc_txt.text = description[p];
            picture_num();
        }
    }else{
        p = 0;
        if (loaded == filesize) {
            picture._alpha = 0;
            picture.loadMovie(image[p], 1);
            desc_txt.text = description[p];
            picture_num();
        }
    }
}
function prevImage() {
    if (p>0) {
        p--;
        picture._alpha = 0;
        picture.loadMovie(image[p], 1);
        desc_txt.text = description[p];
        picture_num();
    }else{
        p = total - 1;
        picture._alpha = 0;
        picture.loadMovie(image[p], 1);
        desc_txt.text = description[p];
        picture_num();
    }    
} 

OK, nevermind my last post. Got it…

Thanks again!

welcome