I want to load 10 different SWF files in a simple for loop
using the SWFLoader. This sometimes fails meaning that only 8 or 9
of the load operations actually completes (the missing ones are not
failing - they just never fire the complete event) .
Below is some simple test code that illustrates the problem.
This test code counts the number of times various events are fired.
If for instance only 8 of 10 load operations are completed, then
there will have been fired 10 open events, but only 8 init,
httpstatus and complete events (and no io error events), but you
can try for your self with this code:
// This code is loading a number of SWF files simultaneously
(in a loop).
// The problem is that momst of the time, not all files are
// If an array of filepaths to 10 different files is used,
then sometimes only 8 of the
// files are loaded, sometimes only 9 and sometimes all 10.
When some files are
// not being loaded, then the init, httpstatus and complete
event is not fired, the but the open
// event is.
// What is wrong, and what can be done to ensure that all
files in the array is always loaded ?
private var loaderCompleteCount:int;
private var loaderIOerrorCount:int;
private var loaderOpenCount:int;
private var loaderInitCount:int;
private var loaderHttpStatusCount:int;
public function MakeLoadTest(filePaths:Array):void
loaderCompleteCount = 0;
loaderIOerrorCount = 0;
loaderOpenCount = 0;
loaderInitCount = 0;
loaderHttpStatusCount = 0;
for each(var path:String in filePaths)
private function testLoadSWF(path:String,
var loader:SWFLoader = new SWFLoader;
private function GetResult():String
var result:String = "\nloaderCompleteCount =
result += "\nloaderIOerrorCount = "+loaderIOerrorCount;
result += "\nloaderOpenCount = "+loaderOpenCount;
result += "\nloaderInitCount = "+loaderInitCount;
result += "\nloaderHttpStatusCount =
I think there is some timing issuses in this, so one idea I
am considering is to make some sequencing, so that the next load
operation is not started until the previous has completed.
Any help with getting this code to always load all the files
is much appreciated !!!
I've seen this before as well with Modules and was told that
it is probably a limitation in the number of connections the
browser can maintain with Flash simultaneously. You will need to
stagger your loading with events or some other mechanism.