Hi can somebody please tell me why my 3 pages are not being brought up when i ‘ctrl enter’. I am making an online game with 3 pages - an instructions page, game screen and end game screen and do not know why my initial page is not opening.
It is sending me the error message:Error #1010: A term is undefined and has no properties.
at MainClass$iinit()
(here is my code)
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class MainClass extends MovieClip{
var instructions:Instructions;
var gameScreen:GameScreen;
var endGameScreen:EndGameScreen;
public function MainClass(){
instructions = new Instructions();
gameScreen = new GameScreen();
endGameScreen = new EndGameScreen();
instructions.playBtn.addEventListener(MouseEvent.CLICK,gotoGame);
gameScreen.endGameBtn.addEventListener(MouseEvent.CLICK,endGame);
endGameScreen.playAgainBtn.addEventListener(MouseEvent.CLICK,playAgain);
addChild(instructions);
}
private function gotoGame(evt:MouseEvent):void{
removeChild(instructions);
addChild(gameScreen);
}
private function endGame(evt:MouseEvent):void{
removeChild(gameScreen);
addChild(endGameScreen);
}
private function playAgain(evt:MouseEvent):void{
removeChild(endGameScreen);
addChild(instructions);
}
}
}