AS3 Self Preloader


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

Add the code at the first frame.


Copy this code and paste it in your HTML
  1. import flash.display.*;
  2. stop();
  3.  
  4. loaderInfo.addEventListener(ProgressEvent.PROGRESS, plLoading);
  5.  
  6.  
  7. function plLoading(event:ProgressEvent):void {
  8. var pcent:int=event.bytesLoaded/event.bytesTotal;
  9. trace(pcent);
  10. if (pcent>=1) {
  11. loaderInfo.removeEventListener(ProgressEvent.PROGRESS, plLoading);
  12. // LOADED!
  13. //nextScene();
  14.  
  15. }
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.