AS3: Preloader on frame 1


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



Copy this code and paste it in your HTML
  1. loader3D.visible = true;
  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. loader_txt.text = Math.floor((loaded/total)*100)+ "%";
  11.  
  12. if (loaded == total){
  13. gotoAndPlay(2);
  14. this.removeEventListener(Event.ENTER_FRAME, loading);
  15. loader3D.visible = false;
  16. }
  17.  
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.