Preloader help!

Sorry for the uneducated post, I’m not quite sure if this is the proper place to ask this. I need some help getting an AS3 preloader to function properly with the actual content it is supposed to be loading.

I’ve read the previous post regarding the issue, (which I found in google and hence created an account specifically to make this thread).

The error I’m getting is this:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main_fla::MainTimeline/frame2()
at flash.display::MovieClip/gotoAndPlay()
at main_fla::MainTimeline/onComplete()

The codes I’ve been using are as follows:

PRELOADER:

stop();

this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);

function onProgress(e:ProgressEvent):void
{
var loaded:Number = e.target.bytesLoaded;
var total:Number = e.target.bytesTotal;
var pct:Number = loaded/total;
loader_mc.scaleX = pct;
loaded_txt.text = "Loading… " + (Math.round(pct * 100)) + “%”;
}

function onComplete(e:Event):void
{

this.gotoAndPlay("2");

}

WEBSITE:

stop();

//Declaring the requests, loader, and container variables.
var about: URLRequest = new URLRequest(“about.swf”);
var bakery: URLRequest = new URLRequest(“bakery.swf”);
var cafe: URLRequest = new URLRequest(“cafe.swf”);
var contact: URLRequest = new URLRequest(“contact.swf”);

//Single loader and container.
var mainLoader:Loader= new Loader();
var myContainer: MovieClip = new MovieClip();
addChildAt(myContainer,1) //Puts container on stage.
addChild(mainLoader);
//Buttons
about_btn.addEventListener(MouseEvent.CLICK, aboutClick);
function aboutClick(Event:MouseEvent):void
{
mainLoader.load(about);
/myContainer.addChild(mainLoader);/
}

bakery_btn.addEventListener(MouseEvent.CLICK, bakeryClick);
function bakeryClick(Event:MouseEvent):void
{
mainLoader.load(bakery);
/myContainer.addChild(mainLoader);/
}

cafe_btn.addEventListener(MouseEvent.CLICK, cafeClick);
function cafeClick(Event:MouseEvent):void
{
mainLoader.load(cafe);
/* myContainer.addChild(mainLoader);*/
}

contact_btn.addEventListener(MouseEvent.CLICK, contactClick);
function contactClick(Event:MouseEvent):void
{
mainLoader.load(contact);
/* myContainer.addChild(mainLoader);*/
}

Any help would be greatly appreciated. If someone would like the files, I can email them to you :slight_smile: