Preloading SWF - Type Error #1009
Hi, I was writing a preloader for an main SWF file, when I came across on the following issue:
My preloader loads main site placed in another SWF - I decided for this way because I have some fonts embedded and it should have big file size. I've done preloader, that has no problems with loading for example images. I tried with SWF and there's a problem:
mainsite.fla - there's only blue rectangle named "square" that is fluid. Here's the code:
stop();
stage.frameRate = 30;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, onStageResize);
function onStageResize(evt:Event):void {
square.width = stage.stageWidth;
square.height = stage.stageHeight/2;
}
Of course it's mistakes-free, works as I want.
But when I load it into another SWF, there's a error: TypeError: Error #1009: Cannot access a property or method of a null object reference at mainsite_fla::MainTimeline/frame1() in my language.
I loads it with standard Loader and URLRequest class, but do not try to get acces to this SWF file, just loads it and it's enough for Flash to show that error.
Can anybody explain me why it's going this way? It's a freelance work, so I have to finish this rather quickly.