import flash.display.*;

stop();

// object loadingBar | the shape mc which sizes according to loaded %
// object loadingPercentage | the dynamic textbox showing % loaded

this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, mainLoading);

loadingBar.x = (stage.stageWidth / 2) - (loadingBar.width / 2);
loadingBar.y = stage.stageHeight / 2;

loadingPercentage.x = stage.stageWidth / 2;
loadingPercentage.y = loadingBar.y + 8;

function mainLoading(event:ProgressEvent):void
{
	var percent:Number = event.bytesLoaded / event.bytesTotal * 100;
	
	loadingBar.scaleX = pcent/100;
	
	loadingPercentage.text = int(percent)+"%";
	
	if(pcent == 100)
	this.gotoAndStop(2);
}