# Checking when last of a series of SWFs has loaded

**URL:** <https://forum.kirupa.com/t/checking-when-last-of-a-series-of-swfs-has-loaded/222989>\
**Category:** flash\
**Created:** [April 18, 2007, 4:31pm UTC](https://forum.kirupa.com/t/checking-when-last-of-a-series-of-swfs-has-loaded/222989 "2007-04-18T16:31:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmichael](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@schmichael](https://forum.kirupa.com/u/schmichael)\
**Post date:** [April 18, 2007, 4:31pm UTC](https://forum.kirupa.com/t/checking-when-last-of-a-series-of-swfs-has-loaded/222989/1 "2007-04-18T16:31:37Z")

</div>

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]
