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();
Comments
Subscribe to comments
You need to login to post a comment.

Is the "customanimation" referring to the "mcwith100frame_animation"?
I received this error when trying it.
1120: Access of undefined property custom_animation.
Your custom animation is a 100 Frame MovieClip with, in this case, an instance name of "mcwith100frameanmiation"