Hiya, thanks for checking out my post. I am trying to load a bunch of swfs whose names are held in an xml file that is loaded first. My problem is that I need to know when all of them have loaded and they may take different amounts of time to load if they are different sizes. I could have a movie clip on 3 frames that cycles through an array of the loading clips and then tells me when they have all loaded but I wondered if there was a neater way to do this using the MovieClipLoader object.
At the moment I get a message when each off the swfs has loaded, I could use a counter variable to store this info but I am thinking this may get a little cluttered if I load a few different groups of movie clips. I would like it so that a few different groups of swf could be loaded and i get an event fired when each group is loaded.
Thanks for any help in advance
Schm
Here is my code:
[AS]
function doSomething() {
trace(“called from onLoad Complete event”);
}
function myLoader(url:String, target:MovieClip) {
var loadCount:Number = 0;
//Listener Objects
oListener = new Object();
oListener.onLoadStart = function(target_mc:MovieClip) {
trace(“Load Started”);
};
oListener.onLoadComplete = function(max, number) {
trace(“Load Complete:”+max+":"+number);
loadCount++;
trace(“loadcount:”+loadCount);
if (max == number) {
doSomething();
}
};
//Loader
mcLoader = new MovieClipLoader();
mcLoader.addListener(oListener);
mcLoader.loadClip(url, target);
}
///////
function loadSWFs(xml:XML) {
var totalSWFs:Number = xml.firstChild.firstChild.childNodes.length;
for (i=0; i<totalSWFs; i++) {
this.createEmptyMovieClip(“holder”+i, i);
myLoader(xml.firstChild.firstChild.childNodes*.attributes.swfName, this[“holder”+i]);
}
}
[/AS]