Can someone help me please?

I am trying to make a very simple preloader, where a movie clip preloads itself.

The problem is that the proloader does not increment on the loaded var, it simply waits until the loader has loaded completly then goes to frame2, therefore not showing the preloader at all.

I suspect it is to do with onEnterFrame, have tried _root.onEnterFrame, but didnt work.

Can someone help? any help will be really good for me.

Below is my code:

Code:
//get the total bytes
var total  = getBytesTotal();

onEnterFrame = function()
{
	loaded = getBytesLoaded();
	pct = int(loaded/total*100);

             //loaded is the movie clip containing the preloader
	loader.percent = "loading"+pct+"%";

	if(loaded >= total)
	{
                          //when loaded is complete go to and stop on frame2
		_root.gotoAndStop(2);
	}

	
}