Created
August 18, 2011 06:24
-
-
Save geraldyeo/1153490 to your computer and use it in GitHub Desktop.
Self preloading indication snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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