Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Response Headers

Recommended Posts



Is there a way to grab the response headers from the LoaderEvent?


Thanks, Lewis

Link to post
Share on other sites

Not consistently (that I know of), no - apparently some browsers limit access to that info, so Flash has a tough time with it. I believe that you can listen for HTTP_RESPONSE_STATUS events if you're publishing to AIR, and the resulting event will usually have a responseHeaders property (get to the original event using the LoaderEvent's "data" property, and make sure you're using the latest version of the LoaderMax files). Again, that's only for AIR apps. 


I wish I had better news for you. 

Link to post
Share on other sites

Ah ok, that's fine...I'm using AIR and have no intention of targeting a browser. I was hoping to make use of the 'onHTTPStatus' event handler shortcut in DataLoaderVars and grab them from the LoaderEvent.


Thanks for the speedy reply Jack. Keep up the good work!!

Link to post
Share on other sites

Hmm, I seem to be getting a null value for event.data. Here's a very basic example...


	import com.greensock.events.LoaderEvent;
	import com.greensock.loading.DataLoader;
	import com.greensock.loading.LoaderMax;
	import com.greensock.loading.data.DataLoaderVars;
	import flash.display.Sprite;
	import flash.net.URLRequest;
	public class Spike extends Sprite
		private var requestQueue:LoaderMax;
		private var loaderVars:DataLoaderVars;
		public function Spike()
			requestQueue = new LoaderMax({
				name : "SpikeQueue",
				maxConnections : 20
			loaderVars = new DataLoaderVars({
				autoDispose : true,
				format : "text",
				onHTTPStatus : onHTTPStatusHandler,
				onComplete : onCompleteHandler,
				onFail : onFailHandler
		private function makeRequest():void
			var request:URLRequest = new URLRequest( "http://search.twitter.com/search.json?q=greensock" );
			var loader:DataLoader = new DataLoader( request, loaderVars );
		private function onHTTPStatusHandler( event : LoaderEvent ):void
			var loader:DataLoader = DataLoader( event.currentTarget );
			trace( "onHTTPStatusHandler" );
			trace( "loader.httpStatus = " + loader.httpStatus );
			trace( "event.data = " + event.data );
		private function onCompleteHandler( event : LoaderEvent ):void
			trace( "onCompleteHandler" );
		private function onFailHandler( event : LoaderEvent ):void
			trace( "onFailHandler" );



Link to post
Share on other sites

What version of LoaderMax are you using?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.