# Problem controlling stage size with preloader

**URL:** <https://forum.kirupa.com/t/problem-controlling-stage-size-with-preloader/331289>\
**Category:** flash\
**Created:** [June 29, 2013, 8:31pm UTC](https://forum.kirupa.com/t/problem-controlling-stage-size-with-preloader/331289 "2013-06-29T20:31:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kickers](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@Kickers](https://forum.kirupa.com/u/Kickers)\
**Post date:** [June 29, 2013, 8:31pm UTC](https://forum.kirupa.com/t/problem-controlling-stage-size-with-preloader/331289/1 "2013-06-29T20:31:23Z")

</div>

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:

```auto
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
