Effective Preloading

I have a flash project that exports at around 3MB, I am trying to create a preloader for it but it seems to get called after the preloading is complete, there for, making it useless.

My stage is empty, nothing on the timeline. The preloading script is called in the main document class.

Does anyone know why this isn’t working, am I calling my preloader function at the wrong place or are my objects in the library loading first?

Thanks for your time, I hope you can help.

Here is the code,


public function Main():void
{			
	preload();
}

public function preload()
{
	//stop playhead
	this.stop();
			
	//draw the preloader bg
	preloader_bg.graphics.lineStyle(1,0x000000,1);
	preloader_bg.graphics.beginFill(0x000000,1);
	preloader_bg.graphics.drawRect(0,0,100,20);
			
	//center the preloader on screen
	preloader.x = Utils.center(1280,100);
	preloader.y = Utils.center(1024,100);

	//add preloader to the stage
	preloader.addChild(preloader_bg);
	preloader.addChild(preloader_bar);
	this.addChild(preloader);
			
	//add event listener for preloading
	this.addEventListener(Event.ENTER_FRAME,preload_ENTER_FRAME);
}
		
public function preload_ENTER_FRAME(e:Event)
{
	//get total loaded
	var total:Number = this.stage.loaderInfo.bytesTotal;
	var loaded:Number = this.stage.loaderInfo.bytesLoaded;
	var percent:Number = (loaded/total) * 100;
	
	//testing -- outputs 100 on load, no progress
	trace(percent);
			
	//update the preloader bar each frame
	preloader_bar.graphics.clear();
	preloader_bar.graphics.lineStyle(1,0x000000,1);
	preloader_bar.graphics.beginFill(0xFFFFFF,1);
	preloader_bar.graphics.drawRect(0,0,percent,20);
			
	//continue when loaded
	if (loaded == total)
	{
		this.removeEventListener(Event.ENTER_FRAME,preload_ENTER_FRAME);
		this.removeChild(preloader);
		preload_COMPLETE();
	}
}