Need help please. Error #1009
Hey guys,
I need a little help with my AS3 game that I am creating for my class. I got this error when I tried to play it. I can't really figure it out.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mazeGame/init()
at mazeGame()
public class mazeGame extends Sprite {
private var theMaze:Maze;
private var theKnight:Knight;
private var theGoal:Goal;
private var theUp:Boolean = false;
private var theDown:Boolean = false;
private var theLeft:Boolean = false;
private var theRight:Boolean = false;
public function mazeGame() {
init();
}
private function init():void {
theMaze = new Maze();
addChild(theMaze);
theMaze.x = stage.stageWidth/2;
theMaze.y = stage.stageHeight/2;
theKnight = new Knight();
addChild(theKnight);
theKnight.x = stage.stageWidth/2 - 100;
theKnight.y = 20;
theKnight.scaleX = theKnight.scaleY = .1;
theGoal = new Goal;
addChild(theGoal);
theGoal.x = stage.stageWidth - 30;
theGoal.y = stage.stageHeight/2;
If you guys need the rest of my code let me know please. Thanks again.