Published in: ActionScript 3
Create a 100 frame MovieClip animation in companion with this code to create a preloader. Place the rest of your Flash application on the following Scene or Frame
/*************************** Event Handler ***************************/ addEventListener(Event.ENTER_FRAME, loading); /*************************** Function ***************************/ function loading(e:Event) { var bytestotal = stage.loaderInfo.bytesTotal; var bytesloaded = stage.loaderInfo.bytesLoaded; var percent = Math.round(bytesloaded * 100/bytestotal); mc_with_100_frame_animation.gotoAndPlay(percent); if (bytesloaded >= bytestotal) { gotoAndStop(2); removeEventListener(Event.ENTER_FRAME, loading); removeChild(custom_animation); } } stop();
You need to login to post a comment.
