I want to upload images with multiple URLLOADER s,so that i could save the time when waiting for the COMPLETE_EVENT.
Sometimes it could get blocked,and it does not give a completion event, does not give a security error, does not give a status event and does not throw an exception. It simply never fires any event at all.
private const RO_NUMBER:int = 2;
private var roPool:Array = new Array();
public function init():void {
for (var i:int = 0; i < RO_NUMBER; i++) {
loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.OPEN, onStartUpload);
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
roPool.push(loader);
}
}
public function startUpload(pictures:ArrayList):void {
_pictures.addAll(pictures);
init();
if (getExternalInfo()) {
for (var i:int = 0; i < RO_NUMBER; i++) {
var loader = roPool.pop();
loader.load(getRequest());
}
} else {
onUploadFinish();
}
}
the load operation is asynchronous and single thread .why could this get blocked?