1009: when referencing stage.stagewidth from the child

[FONT=monospace]Hi, I was hoping you could help me out my hair is getting grey.

I have a main.swf and a slider.swf. I load the slider.swf into main.swf.

In my slider.swf I have this code which adds an image to the stage from the Library:
[/FONT]

var photo1_mc:photo1 =new photo1;
addChild(photo1_mc);
photo1_mc.x=stage.stageWidth/2;

[FONT=monospace]

The code works fine when compiling slider.swf, but when loading the slider.swf into the main.swf I receive TypeError: Error #1009: Cannot access a property or method of a null object reference.

I assume it has to do with the stage.stageWidth. Is there a another way to reference the stage.

If I load the the image externally via a loader I can use the stage.stage Width.

THANX ALOT

[/FONT]