Skip to content

Instantly share code, notes, and snippets.

@geraldyeo
Created August 18, 2011 06:24
Show Gist options
  • Select an option

  • Save geraldyeo/1153490 to your computer and use it in GitHub Desktop.

Select an option

Save geraldyeo/1153490 to your computer and use it in GitHub Desktop.
Self preloading indication snippet
stop();
loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loaderInfo.addEventListener(Event.COMPLETE, loadComplete);
function loadProgress( evt:ProgressEvent ):void {
var ratio:Number = loaderInfo.bytesLoaded/loaderInfo.bytesTotal;
var percent:int = int( ratio*100 );
trace( percent + "%" );
}
function loadComplete(e:Event):void {
play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment