You cannot add the stage to your Class instance.
You add your class instance
to the stage. Once that has occurred, the code in your class file can make references to the stage.
The standard way to do this is to listen for Event.ADDED_TO_STAGE in the external class or swf constructor.
In the Event handler, you can make the references to the stage without errors.
ActionScript Code:
package
{
import flash.display.*;
import flash.events.*;
public class ChildClass extends Sprite
{
public function ChildClass()
{
if (stage)
{
init(null);
}
else
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
}
private function init(e:Event):void
{
trace(stage);
}
}
}