The "stage" property isn't set until after the constructor finishes running for your game - so if you have anything in the constructor that points to stage (like stage.stageWidth) you need to move that outside to a function that's called after the constructor finishes. Here's the setup I use to get around the problem. Also for a really good rundown on preloading, you should check out Lee's tutorial over at gotoAndLearn.com.
PHP Code:public function Constructor(){
super();
// stage doesn't exist here yet
addEventListener(Event.ADDED_TO_STAGE, function(e:Event):void{
e.target.removeEventListener(e.type, arguments.callee);
init();
});
}
private function init():void{
// stage exists here
}




Reply With Quote