How to create a Loader


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.