I want to dynamically load several png images from 6K to 2,5M.
I create the loaders in a for loop and start them all at the same time, and listen Progress, Complete, IOError and SecurityError on each loader.
The problem is the COMPLETE events are not always fired, even if Progress events show all images are fully downloaded.
I tested with Firefox and Chrome, I load 4 images 2.5M, 2M, 1M, and 6K, then I just get 2 or 3 COMPLETE events, sometimes the 4 are fired with Chrome.
Did not find any workaround. I tried to listen ProgressEvent and call the completeHandler when bytesLoaded == bytesTotal but the loaderInfo.content is null (and bytesAvailable =0) so I can't get the Bitmap.
1) Is there a known limitation in the number of simultaneous loaders, from flash player or browsers ? Does Adobe recommend to have queued loaders instead of simultaneous ?
2) Is there a way to get the loaded Bitmap when COMPLETE is not fired ?
3) I don't keep the loaders in a property of my class, and use weakReference for the listeners : the issue can come from my code ? (but the ProgressEvents are received until the download is complete)
There is a limit for the concurrent download connections imposed by the browser. For example IE is 2 by default. However issuing 4 load requests at the same time should be absolutely fine. Try BulkLoader https://github.com/arthur-debert/BulkLoader to see if it handles your downloads any better.
I saw Firefox and Chrome limit the number of concurrent connections to 6 so it should not be a problem.
I tried BulkLoader and it works but it creates just 2 concurrent connections for each host domain.
I could do the same and limit the number of concurrent loads to 2 per domain but I think the total download would be slower, so I'm still trying to have more concurrent downloads.
I see many topics on several forums about the Event.complete no being fired but no solution for me.
Is this a known problem ? should I stop trying to have more than 2 concurrent downloads ?
You can set the max number of connection for BulkLoader with maxConnectionsPerHost property. So why don't you set it to 6 or higher and test to see if the problem actually lies in the number of the connections or something else.
I think I finally understand what is the problem :
I added an anonymous function as eventListener for the complete event, and use weak reference.
according to this post it seems to be the problem.
The weird thing is I do the same for progress events but I receive all of them.