AIR API Tip: Use HTTP_RESPONSE_STATUS, not HTTP_STATUS

| 1 Comment

AIR extends the existing Flash URLLoader, URLStream, and FileReference classes with a new event type, HTTP_RESPONSE_STATUS. If you're writing an AIR application, you probably want to use this new event instead of HTTP_STATUS. Both events are instances of HTTPStatusEvent, but there are two major differences.

Additional Properties The HTTPStatusEvent has two new properties, responseHeaders and responseURL. These properties are available for HTTP_RESPONSE_STATUS but not HTTP_STATUS.

Earlier Dispatch The HTTP_STATUS event is dispatched after the request is completed and immediately before the COMPLETE event itself is sent. HTTP_RESPONSE_STATUS is dispatched as soon as the headers have been processed, before the data is available. If your request contains a lot of data or is made over a slow link, this can be significantly earlier.

Why did AIR introduce the new event type, instead of just re-using HTTP_STATUS? Compatibility: We didn't want to break any existing code.

1 Comment

Hi Sir..

Would you mind to giving me a usage example of this event? I'm using HTML/JavaScript. I'm trying to access file header information from server.

Thanks

[You can find an example of HTTP_STATUS in the HTTPStatusEvent documentation and easily adapt it to HTTP_RESPONSE_STATUS. See also Accessing AIR APIs from JavaScript. -Oliver]

Leave a comment

About this Entry

This page contains a single entry by Oliver Goldman published on February 19, 2008 7:51 PM.

iCal Scalability was the previous entry in this blog.

Support for AIR Beta Applications After 1.0 Ships is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.