Hi,
I have a question on the order in which events are being fired by LoaderMax. Specifically, when I have maxConnections set to 1, I would expect that the open and complete events would fire as each file is handled (ie. interspered within the overall progress of the loader). However, this is not what I am seeing. Here's an example:
_loader = new LoaderMax({name:"Loader", maxConnections:1, onProgress:loadHandler});
_loader.append(new XMLLoader("config.xml", {name:"Config", onOpen:configHandler, onComplete:configHandler, onChildOpen:configHandler, onChildComplete:configHandler}));
_loader.load();
function configHandler(e:LoaderEvent):void
{
switch(e.type)
{
case LoaderEvent.OPEN:
case LoaderEvent.CHILD_OPEN:
Debug.info("File {0}", e.target.name);
break;
case LoaderEvent.COMPLETE:
case LoaderEvent.CHILD_COMPLETE:
Debug.info("Complete {0}", e.target.name);
break;
}
}
function loadHandler(e:LoaderEvent):void
{
switch(e.type)
{
case LoaderEvent.PROGRESS:
Debug.info(" Progress {0}", e.target.progress);
break;
}
}
In this case, I'm loading a config file with two SWF children loaders the file (Test1 and Test2). Test1.swf and Test2.swf are both the same size - approx. 600K. The Progress is begin displayed for the loader instance, so I would expect that Test1.swf would complete at about 50% progress. Here's what I actually when I execute:
[2011-04-15 17:16:54] INFO: File Config
[2011-04-15 17:16:54] INFO: Progress 0.9897727272727272
[2011-04-15 17:16:54] INFO: File Test1
[2011-04-15 17:16:54] INFO: File Test2
[2011-04-15 17:16:54] INFO: Progress 0.05419404715887128
[2011-04-15 17:16:54] INFO: Progress 0.15974745522484216
[2011-04-15 17:16:54] INFO: Progress 0.26530086329081304
[2011-04-15 17:16:54] INFO: Progress 0.3708542713567839
[2011-04-15 17:16:54] INFO: Progress 0.4764076794227548
[2011-04-15 17:16:54] INFO: Progress 0.5512355104823917
[2011-04-15 17:16:54] INFO: Progress 0.656133055467522
[2011-04-15 17:16:54] INFO: Progress 0.7610306004526524
[2011-04-15 17:16:54] INFO: Progress 0.8659281454377827
[2011-04-15 17:16:54] INFO: Progress 0.970825690422913
[2011-04-15 17:16:54] INFO: Progress 0.9950067128613332
[2011-04-15 17:16:54] INFO: Complete Test1
[2011-04-15 17:16:54] INFO: Complete Test2
[2011-04-15 17:16:54] INFO: Complete Config
[2011-04-15 17:16:54] INFO: Progress 1
So my basic question is why are the open and complete events for Test1 and Test2 get fired at the beginning and end of the load - i.e. why does the complete event for Test1 not occur at approx. 50% into the load (since it accounts for about 50% of the data being loaded). I even tried simulating the download at a slow speed, but no different in the order of events. What am I missing?
Thanks!