Posted By

nate63179 on 11/03/09


Tagged

flash load as3 utils


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Demian
adrianparr


Flash: check self loaded


 / Published in: ActionScript 3
 

Simple on enter frame event for detecting if base movie has loaded.

_isXmlLoaded = whether XML config has been loaded by flash preloader = some stage preloader

  1. /**
  2. * Checks the movie to detec when it's been fully loaded
  3. */
  4. private function checkSelfLoaded(e:Event) : void {
  5. var bytesLoaded:Number = this.loaderInfo.bytesLoaded || 1;
  6. var bytesTotal:Number = this.loaderInfo.bytesTotal;
  7. var pLoaded:Number = Math.round((bytesLoaded / bytesTotal) * 100);
  8.  
  9. if (pLoaded == 100 && (framesLoaded == totalFrames)) {
  10. removeEventListener(Event.ENTER_FRAME, checkSelfLoaded);
  11. preloader.addEventListener(PreloaderEvent.COMPLETE, onPreloaderComplete, false, 0, true);
  12. //doSomething();
  13. }
  14. } // end checkSelfLoaded

Report this snippet  

You need to login to post a comment.