-
[CS3] Preload images in a slideshow using XML
Hello,
i am building a website where i use a slideshow in flash. I load the pictures into a movieclip in flash using XML. It all works, but it is a bit slow, because the images is not loaded until the user hits the next button. So I wonder if its possible to change my AS in flash to make it load the next image while the user looks at the first picture? I would be very glad if someone could help me with this. Please see my code below:
images_xml = new XML();
images_xml.onLoad = startImageViewer;
images_xml.load("xml/images.xml");
images_xml.ignoreWhite = true;
function startImageViewer(success) {
if (success == true) {
rootNode = images_xml.firstChild;
totalImages = rootNode.childNodes.length;
firstImageNode = rootNode.firstChild;
currentImageNode = firstImageNode;
currentIndex = 1;
updateImage(firstImageNode);
}
}
function updateImage(newImageNode) {
imagePath = newImageNode.attributes.imgURL;
targetClip.loadMovie(imagePath);
imageCount = currentIndex+" / "+totalImages;
}
next_btn.onRelease = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode == null) {
break;
} else {
currentIndex++;
updateImage(nextImageNode);
currentImageNode = nextImageNode;
}
};
back_btn.onRelease = function() {
previousImageNode = currentImageNode.previousSibling;
if (previousImageNode == null) {
break;
} else {
currentIndex--;
currentImageNode = previousImageNode;
updateImage(previousImageNode);
}
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|