Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.events.Event;
- stop(); //stop the flash at the first frame
- this.addEventListener (Event.ENTER_FRAME, loading);
- function loading (e:Event){
- //important stuff
- var total:Number = this.stage.loaderInfo.bytesTotal;
- var loaded:Number = this.stage.loaderInfo.bytesLoaded;
- //showing progress
- var loadper = Math.round((loaded/total)*100);
- txtLoad.text = loadper + "%"; //REMOVE THIS LINE IF YOU DON'T HAVE A PROGRESS TEXTBOX
- //check if flash is done loading
- if(total <= loaded){
- this.removeEventListener(Event.ENTER_FRAME, loading);
- //Start flash in frame two
- gotoAndStop(2);
- }
- }
- /* REMEMBER TO CHANGE LOAD PRIORITIES
- * do this:
- * File > Actionscript settings
- * Set "export classes in frame" to 2
- * then in the library; Right click big assets used in frame 2 i.e. flv files, music etc.
- * go to properties > Actionscript
- * Check Export for actionscript and Export in frame 2
- * NOTE, if you use a sound in the preloader, do not export that to frame 2
- * Also a quick way to test your preloader (if you're using CS6) press ctrl enter twice to simulate download, remember to change the
- * download speed
- * This can be done in View > Download settings
- * Good luck
- */
Advertisement
Add Comment
Please, Sign In to add comment