I am working on a slideshow where images are loaded from XML.
Currently the slide show starts when all the images are loaded.
I want to preload one image at one time i.e when first image is loaded,first image should be displayed then preloader for next image is to be shown and after that next images is displayed and so on…
Here’s some code I posted onto Actionscript dot org a fair while ago - it may help you out. Basically the bit to look at is the function: loadNewImage(img) which has an onComplete handler - when the this is called it recursively calls the same function to load the next image until they are all in.
May or may not help but worth a try.
MJ
fscommand(“allowscale”, false);
_root._quality = “BEST”;
stop();
var home:MovieClip = this;
path = ‘’; // path to images folder
loaderClips = new Array(home.loaderOne,home.loaderTwo,home.loaderThree,home.loaderFour,home.loaderFive,home.loaderSix);
i=0; // counter to track what image you are on
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.load(“icons.xml”);
xml.onLoad = function(success) {
if (success) {
var nodes = this.firstChild.childNodes;
// make a globally available array of images
_root.ar_images = new Array(
nodes[0].attributes.image,
nodes[1].attributes.image,
nodes[2].attributes.image,
nodes[3].attributes.image,
nodes[4].attributes.image,
nodes[5].attributes.image
);
_root.loadNewImage(_root.ar_images[_root.i]);
};
};
function loadNewImage(img) {
var myClip = eval(_root.loaderClips[_root.i]);
var imageName = _root.path+img;
var myMC = new MovieClipLoader();
myMC.loadClip(imageName,myClip);
myMC.onLoadStart = function(myClip) {
trace("loading "+img+" into "+myClip);
}
myMC.onLoadComplete = function (myClip) {
if(_root.i<(_root.ar_images.length-1)) {
_root.i++; // increment the counter
_root.loadNewImage(_root.ar_images[_root.i]); // load next image
} else { // play movie once all have loaded
home.play();
}
}
myMC.onLoadError = function (myClip, errorDetails) {
trace("error loading "+img+" into "+myClip);
trace ("ERRORCODE:" + errorDetails);
}