package {
import flash.display.Stage;
public class MyGlobal {
public static var CX:Number = stage.stageWidth / 2;
public static var CY:Number = stage.stageHeight / 2;
}
}
The Error is "1120: Access of undefined property stage."
WHY?
As mentioned, stage is a property of classes that inherit from DisplayObject. Stage is not available to a class until it has been added to the stage, generally via the addChild method of a DisplayObjectContainer.