0 Replies Latest reply on Apr 17, 2009 10:00 AM by Bryan.Sampieri

    Why is HTTPStatusEvent last?

    Bryan.Sampieri Level 1

      New to Flex/Flash (1 week in) and have looked around, but can't find an explanation of this...  given this code...


      var loader:URLLoader = new URLLoader(aRequest);
      loader.addEventListener(Event.OPEN, openHandler);
      loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
      loader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
      loader.addEventListener(Event.COMPLETE, completeHandler);


      Why is HTTPStatusEvent the last event you get before the URLLoader completes?


      The HTTP status is the first thing the server sends back to the client in the response header.  Why would this event be held until all the load progress is done and just before the complete event is fired?  It should be fired first after open event to let you know the status.  Particularly important with URLStream where you will likely start reading data before it's complete, and it would be good to know if you are getting a non-200 code that might have different contents.