We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

chrisaiv on 02/11/08


Tagged

as3


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

abdsign
outbox
visuallyspun


AS3: Using URLLoader for Text and XML


Published in: ActionScript 3 


URLLoader is not the same as Loader. It is meant to load text, html, sound, xml, and swf content. If you want to load an image, use Loader().


  1. var assetLoader:URLLoader = new URLLoader();
  2. assetLoader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
  3. assetLoader.addEventListener(Event.COMPLETE, completeHandler);
  4.  
  5. function progressHandler(e:Event):void
  6. {
  7. trace(e.currentTarget.bytesLoaded + " / " + e.currentTarget.bytesTotal);
  8. }
  9. function completeHandler(e:Event):void
  10. {
  11. trace("completeHandler:" + e.currentTarget + " :: " + e.currentTarget.dataFormat + " :: " + e.currentTarget.data);
  12. }

Report this snippet 

You need to login to post a comment.