Custom Preloader

/***************************
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();

source

Leave a Reply