Skip to main content
Participant
July 19, 2008
Answered

Fast Forward images from XML file

  • July 19, 2008
  • 1 reply
  • 262 views
Hi

Im making a dynamic slideshow webcomic to flip trough a number of pages i update frequently, so im using a XML file and I have everything working quite great but i have a question.

I need to have a button that sends the viewer to the very last (or latest page) or the very first page instead of flipping trough the entyre ammount of pages (it would get annoying if there are like 90 pages)

But i dont know how to set those two buttons.


Here is the actionscript im working with



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);
}
//
// Event handler for 'Next slide' button
next_btn.onRelease = function() {
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null) {
break;
} else {
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);
}
};
This topic has been closed for replies.
Correct answer glenfx
Thank you very much Noelbaland
the "skip to last" button script i wrote was quite similar to yours but had three terrible mistakes in it, and the "go to first" button i wrote just didn't come close at all hehehe ^^.

Thank you very much again for the help, i was loosing mi mind trying to make them work :D

1 reply

Noelbaland
Participating Frequently
July 20, 2008
Hello,

Don't change anything to your script but add 2 buttons to the stage and name them(in this case) first_btn and last_btn. Add the following code to your script. Hope it helps.

glenfxAuthorCorrect answer
Participant
July 20, 2008
Thank you very much Noelbaland
the "skip to last" button script i wrote was quite similar to yours but had three terrible mistakes in it, and the "go to first" button i wrote just didn't come close at all hehehe ^^.

Thank you very much again for the help, i was loosing mi mind trying to make them work :D