Problem controlling stage size with preloader

Hi,

I am creating a flash website where the stage resizes and the elements on the stage reposition when the browser window is resized.

I had the main flash file working fine. The stage was resizing correctly, but I ran into problems when I tried to set up a preloader flash file, that would load the main file in and display a progress bar.

The problem is, that when I test the preloader file I get an error message. This error seems to come from frame 1 of the main flash file. The preloader file cannot recognise the stageWidth and stageHeight properties which are used in frame 1 of the main flash file.

The strange thing is that on frame 2 of the main flash file it all works fine. Could anyone tell me why the stageWidth and stageHeight properties of an externally loaded flash file would only work on frame 2 of an externally loaded swf?

I have attached a simple version of the preloader and main flash files. The main flash file is called “opening_animation_test.fla” In frame 1 of the main flash file, if I put in the Actionscript:

trace(stage.stageWidth);

I get an error message when I test the preloader flash file, but if I put this into frame 2 it traces correctly.

As a result of this problem I am not able to use a preloader if I want to control the position of content in frame 1 of my main flash file, which is a real problem for what I am trying to do. Could anyone tell me what I am doing wrong?

Any advice would be greatly appreciated

Thanks