Preloading Function Problem - Need some assistance

Hey Guys,

Basically I’m using the concept of creating a preloader .swf file, that loads my main flash website swf file into it.

The main problem I receive is

 "TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at 4th2010_fla::MainTimeline/preload()

Now I’ve been trouble shooting this for a good chunk of time, and what I’ve found is that it must be something to do with the .swf I’m loading in because when I use a simple .swf file with basically just a picture in it, it loads fine, but the file I want to load in contains movie clips and graphics, embeded video and such.

What happens is that the content swf aka “4th2010-Website.swf” is loaded over and over and over until it basically freezes the computer. It doesnt matter if I put a stop command on the first frame of the swf. The fileLoaded function and load command keeps repeating.

Here is my preloader code:


/* Preloader Script */

var reqMain:URLRequest = new URLRequest("4th2010-Website.swf");
var loader:Loader = new Loader();

// fileLoaded function is called upon completion of the content being loaded.

function fileLoaded(event:Event):void {
	loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, fileLoaded);
	loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, preload);
	addChild(loader);

}

// Have an dynamic text field on the stage to display the percent loaded

function preload(event:ProgressEvent):void {
	var percent:Number = Math.round( ( event.bytesLoaded / event.bytesTotal ) * 100);
	percent_txt.text = String(percent) + "%";

}

// establishes the listeners and then initiates the load command
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, fileLoaded);
loader.load(reqMain);


/* End of Preloader Script */

Thanks a ton for your help guys.
~ CurtK