I know AS2 and am finally converting to AS3 now by following a book. My code is exactly the way it is in the book and everything in my library (the buttons, movieclips) are linked correctly, but I keep getting the same error 1010 that a term is undefined or has no properties. I want to know if I'm being dumb (I hope not), or if the book is outdated. Hopefully someone can help. I put in a picture of what my assets look like, as well as the code below it.
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip{
var startPage:StartPage;
var hillPage:HillPage;
var pondPage:PondPage;
public function Main() {
startPage = new StartPage();
hillPage = new HillPage();
pondPage = new PondPage();
addChild(startPage);
startPage.HillButton.addEventListener(MouseEvent.CLICK, onHillButtonClick);
startPage.PondButton.addEventListener(MouseEvent.CLICK, onPondButtonClick);
}
function onHillButtonClick(event:MouseEvent):void{
addChild(hillPage);
removeChild(startPage);
}
function onPondButtonClick(event:MouseEvent):void{
addChild(pondPage);
removeChild(startPage);
}
}
}