Hey Guys
So here is something~ I am working on a website with xml menu and “slideshows”. The xml is working beatifully, what I am having trouble with is stopping a function and restarting it later… I know it sounds easy, but I can’t get it to work.
Here is the deal. There is an opening slideshow… So I created a function slideshow that loops through all the opening slideshow images. When you click on a button from the “work” menu, another slideshow is loaded through the same xml “loader”, but I need to make the SLIDESHOW STOP, and restart again when someone clicks another button.
So I have done something like this.
//function that automatically goes through all the images
pause_slideshow=4000
function slideshow() {
myInterval = setInterval(mySlideshow, pause_slideshow);
function mySlideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
firstImage();
} else {
Forward();
}
}
}
//function that "resets slideshow"
function resetSlideshow(val) {
if (val == -1) {
slideshow = null;
} else if (val == 0) {
slideshow();
function slideshow() {
myInterval = setInterval(mySlideshow, pause_slideshow);
function mySlideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
firstImage();
} else {
Forward();
}
}
}
}
}
//button that stops the slideshow
mcWork.onPress=function(){
resetSlideshow(-1)
xmlData.onLoad=loadslideshow
xmlData.load("newXml.xml")
}
//button that needs to restart the original slideshow
mcContact.onPress=function(){
resetSlideshow(0)
xmlData.onLoad=loadslideshow
xmlData.load("OriginalXml.xml")
}
So this is where I am stuck right now. When u click the button mcWork, the slideshow will stop, but it won’t restart again. If you click mcContact, mcWork won’t stop the slideshow…
any suggestions?