After learning of this excellent method of accessing an object placed on the stage in Flash CS5 in a class other than the document class (found in this thread), I have run into
The fact that you can not access the instances on the stage in a class' constructor but can in another function of the class (that you call later I assume) makes me think that stage is not available to your constructor when it is being called.
Check to make sure that your Game.as document class is set up like this, although it probably is since you followed my method:
public function Game() {
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
//DO NOT CREATE CLASS INSTANCES IN HERE
}
private function init(e:Event):void{
//In here is where we create instances of classes
}
Additionally, set your stage data type to Stage
instead of Object
in your Player class's constuctor's paramater for good coding practice.