you can do it one of two ways.
1) Wait for the child swf to be added to the stage before trying to access it...
myChildSwf.as
Code:
package
{
import flash.events.*;
import flash.display.*;
public class myChildSwf extends Sprite
{
public function myChildSwf()
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
trace(Stage.stageWidth);
}
}
}
2) Pass the stage to the child swf when instantiating...
Parent Swf
Code:
var myChild:myChildSwf = new myChildSwf(stage);
myChildSwf.as
Code:
package
{
import flash.events.*;
import flash.display.*;
public class myChildSwf extends Sprite
{
public function myChildSwf(stg:*)
{
trace(stg.stageWidth);
}
}
}