I am using Flex 4, ActionScript 3.
My frontend client needs to call a URL that will do the following:
1. Produce a zip file containing grammar files that are previously generated.
2. Create an entry in this zip file for a prompts list file.
3. Stream this zip file to the client.
Also, ff the grammar files have not been previously generated, the middleware sends back a 404 HTTP status code.
I've used the FileReference upload method before. For the upload, I can explicitly call the FileReference browse method to bring up the operating system's "Select file to upload" dialog box. The upload also dispatches two very useful events: httpStatus and httpResponseStatus.
Now for my current task of doing the download, I've noticed two differences from the upload:
1. The browse method is incorporated into the download method to automatically bring up the operating system's "Select location for download" dialog box.
2. The httpStatus and httpResponseStatus events do not exist for download.
Why are there these differences for the download?
I briefly looked at the URLLoader class. This class does dispatch the httpStatus and httpResponseStatus events. However, there is no explicit or implicit browse method.
Can you please let me know what I can do to fulfill all of my requirements for this task?
when using download:
2038 IOError would be returned - at least as far as I can tell - if server returns:
HTTP/1.1 404 Not Found
status code that error would be thrown and then dispatched (but it won't contains 404 specific information - instead some general IO error for server url will be provided). So add IOErrorEvent.IO_ERROR to your FileReference instance - that is something you could try,