Posted By

chrisaiv on 02/11/08


Tagged

as3


Versions (?)

Who likes this?

9 people have marked this snippet as a favorite

abdsign
outbox
visuallyspun
THEPWN3R
enajenkins
ClayVillage
ssolen
donaldleegraham
tspitzr


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.