flash preloader for AS3


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

can solve the IE reload problem


Copy this code and paste it in your HTML
  1. stop();
  2.  
  3. this.addEventListener(Event.ENTER_FRAME, loading);
  4.  
  5. function loading(e:Event):void{
  6.  
  7. var total:Number = this.stage.loaderInfo.bytesTotal;
  8. var loaded:Number = this.stage.loaderInfo.bytesLoaded;
  9.  
  10. lbar.scaleX = loaded/total;
  11. loader_txt.text = Math.floor((loaded/total)*100)+ "%";
  12.  
  13. if (total == loaded){
  14. gotoAndPlay(2);
  15. this.removeEventListener(Event.ENTER_FRAME, loading);
  16. }
  17.  
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.