Hey James,

 

Thanks for the pointer - I did check out anirudh's article before attempting
to write my own.  What are your thoughts on the code?

 

Karthik

 

Karthik Kailash | Product

SocialVision, Online Television Becomes a Social Experience

CELL . 408.768.7704  | WEB . www.socialvisioninc.com | FACEBOOK .
<http://www.facebook.com/socialvision> facebook.com/socialvision | TWITTER .
<http://twitter.com/socialvision> twitter.com/socialvision

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of jamesfin
Sent: Saturday, December 26, 2009 9:11 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Using URLLoader with AsyncToken

 

  


This is another starting point....

http://anirudhs.chaosnet.org/blog/2008.06.20.html

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ,
"Karthik Kailash" <kart...@...> wrote:
>
> Hi all,
> 
> I was trying to retrieve binary data over HTTP for my Flex application,
and
> was running into some stumbling blocks. HTTPService did not seem to deal
> with binary data well, people said to use URLLoader. But URLLoader does
not
> have the nice AsyncToken/IResponder interface that HTTPService provides.
> 
> So, I did some searching and could not find anyone extending URLLoader to
> provide this kind of functionality. I went ahead and took a stab at it
> myself: <http://pastebin.com/d7369d0e0> http://pastebin.com/d7369d0e0
> 
> Basically it wraps a URLLoader and an AsyncToken, and maps the COMPLETE,
> IO_ERROR, and SECURITY_ERROR events from URLLoader to results/faults that
> get raised on the AsyncToken.
> 
> Basic usage:
> 
> var tidbitLoader:AsyncURLLoader = new AsyncURLLoader();
> 
> 
> tidbitLoader.dataFormat = URLLoaderDataFormat.BINARY;
> 
> 
> 
> 
> 
> var asyncToken:AsyncToken = tidbitLoader.load(new
> URLRequest("http://localhost/SampleTidbit.swf";));
> 
> 
> 
> 
> 
> asyncToken.addResponder(this);
> 
> 
> 
> 
> 
> public function result(resultEvent:Object):void
> 
> 
> {
> 
> 
> trace("result");
> 
> 
> }
> 
> 
> 
> 
> 
> public function fault(faultEvent:Object):void 
> 
> 
> {
> 
> 
> var fault:FaultEvent = faultEvent as FaultEvent;
> 
> 
> trace("fault: " + fault.toString());
> 
> 
> }
> 
> 
> 
> 
> 
> 
> 
> Is this the right way to approach the problem? Are there existing
solutions?
> I would love to hear feedback.
> 
> Thanks,
> 
> Karthik
> 
> 
> 
> Karthik Kailash | Product
> 
> SocialVision, Online Television Becomes a Social Experience
> 
> CELL . 408.768.7704 | WEB . www.socialvisioninc.com | FACEBOOK .
> <http://www.facebook.com/socialvision> facebook.com/socialvision | TWITTER
.
> <http://twitter.com/socialvision> twitter.com/socialvision
>



Reply via email to