Posted By

heathbo on 10/05/10


Tagged


Versions (?)

How to create a Loader


 / Published in: ActionScript 3
 

add every item in the library to the frame that comes after this code.

  1. addEventListener(Event.ENTER_FRAME, loading);
  2. stop();
  3.  
  4. function loading(event:Event)
  5. {
  6. var bytestotal = stage.loaderInfo.bytesTotal;
  7.  
  8. var bytesloaded = stage.loaderInfo.bytesLoaded;
  9.  
  10. var loader = Math.round(bytesloaded*100/bytestotal);
  11.  
  12. moviePreloader_mc.LoaderMask.scaleX = loader/100;
  13. moviePreloader_mc.percent2.text = int(loader)+"%";
  14.  
  15. if (bytesloaded == bytestotal)
  16. {
  17. gotoAndPlay(2);
  18.  
  19. removeEventListener(Event.ENTER_FRAME, loading);
  20. }
  21. }

Report this snippet  

You need to login to post a comment.