Posted By

flashinit on 06/17/09


Tagged

timeline preloader


Versions (?)

Timeline preloader


 / Published in: ActionScript 3
 

  1. //===================
  2. // Timeline Preloader
  3. // flashinit.com/blog
  4. //===================
  5.  
  6. stop();
  7.  
  8. this.addEventListener(Event.ENTER_FRAME, handleLoading);
  9.  
  10. function handleLoading(event:Event):void{
  11.  
  12. var total:Number = event.currentTarget.loaderInfo.bytesTotal;
  13. var loaded:Number = event.currentTarget.loaderInfo.bytesLoaded;
  14.  
  15. trace(int((loaded/total)*100)+ "%");
  16.  
  17. if (loaded >= total){
  18. // Done
  19. this.gotoAndStop(2);
  20. this.removeEventListener(Event.ENTER_FRAME, loading);
  21. }
  22.  
  23. }
  24.  
  25.  
  26. //=================

Report this snippet  

You need to login to post a comment.