I am working on a Flash file upload widget, and I want it to upload one file at a time. In my upload function, I currently have a FileReferenceList, and I am looping through it, calling upload on each one. However, since FileReference.upload is non-blocking, all of the uploads are going simultaneously.
Is it possible to make the uplaod function block? Or do I need to chain the uploads together, by registering an event to upload the next one when the first one’s Event.COMPLETE event fires?
No, you can’t generally do that with AS3, you have to manage the “asynchronous” requests through chaining.
I would usually have my list of files and upload one, catching the complete event and then do another. Same principle applies for downloading or retrieving files with URLLoader.