stop();
addEventListener(Event.ENTER_FRAME, handleProgress);
function handleProgress(e:Event)
{
var total:Number = Math.round(stage.loaderInfo.bytesTotal / 1024);
var loaded:Number = Math.round(stage.loaderInfo.bytesLoaded / 1024);
var percent:Number = Math.round(loaded / total * 100);
load_bar.scaleX = percent / 100;
load_text.text = percent + "% (" + loaded + "kb / " + total + "kb)";
if (loaded >= total)
{
removeEventListener(Event.ENTER_FRAME, handleProgress);
gotoAndPlay(1, "main");
}
}
|