Posted By

zeman on 07/10/08


Tagged

jpg png gif textmate load swf loader


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

visuallyspun
taboularasa
abdsign
THEPWN3R


Loader


 / Published in: ActionScript 3
 

  1. var request:URLRequest = new URLRequest("image.jpg");
  2. var loader:Loader = new Loader();
  3.  
  4. loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
  5. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
  6.  
  7. function loadProgress(event:ProgressEvent):void {
  8. var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
  9. percentLoaded = Math.round(percentLoaded * 100);
  10. trace("Loading: "+percentLoaded+"%");
  11. }
  12.  
  13. function loadComplete(event:Event):void {
  14. trace("Complete");
  15. }
  16.  
  17. loader.load(request);
  18. addChild(loader);

Report this snippet  

You need to login to post a comment.