Problem with simple preloader

I’ve added the following piece of AS to frame 1:

this.onEnterFrame = function()
  {
	total = this.getBytesTotal();	
	loaded = this.getBytesLoaded();	
	percent = Math.round (loaded/total*100 );
	
	loadingText = percent;
	
	if (loaded >= total) {
		nextFrame();
		} 
  }
stop();

The preloader actually works fine, but the movie just plays till the end of the timeline and ignores the stop(); action I’ve put in a later frame. Without the preloader the movie works fine.

I hope someone can tell me what I’m doing wrong.