Error#1009. Actionscript error in Flash Game I'm making...
Hi,
I'm making a Flash game and rather than putting all the AS3 on a seperate .as file, I'm throwing it on the timeline, which may or may not be a mistake since this game is getting really big, really fast and messy.
And so I'm getting this error when I test:
TypeError: Error #1009: Cannot access a property or method of a null object reference at GameBeta_MainTimeline_fla::MainTimeline/frame1()
From what I've read on this error, it refers to something that isn't instantiated yet, like something that's out of order? Like I'm referring to something that doesn't exist at the point in time that I'm referring to it? So I'm looking at my AS3 and have NO idea. Here is what I have written:
stop();
//TITLE PAGE
play_game.addEventListener(MouseEvent.CLICK, startgame)
function startgame(evt:MouseEvent):void
{
gotoAndStop("Name Input");
}
//Name and Gender input page
var userName:String;
inputField.addEventListener(Event.CHANGE, onInput)
function onInput(e:Event):void
{
outputField.text = "So your name is " + inputField.text + " are you sure?";
userName = inputField.text;
}
confirm_input.addEventListener(MouseEvent.CLICK, toCreationpg)
function toCreationpg(evt:MouseEvent):void
{
gotoAndStop("Fem Creation");
outputField.text = "So your name is "+ userName;
}
//Character Creation Page
readytostart.addEventListener(MouseEvent.CLICK, firstscene_plz)
function firstscene_plz(evt:MouseEvent):void
{
gotoAndStop("Day03");
outputField.text = "Let's make your character, "+ userName;
}
So, any ideas as to why I'm getting this error?
Before I had each page with it's own Actionscript and buttons inside their own movieclips on the timeline. That was getting confusing so I took everything out of the movieclips to place everything on one timeline and have one layer of Actionscript hoping to simplify things and find the problem easier. No luck. It's supposed to have a Title page and a button that goes to the 2nd page where you input your name, and while you type, it shows your name before you confirm by hitting another button that finally goes to the Character Creation page. When I test, I just get that Error#1009, it'll get to the 2nd page for the name input, but the text fields act wacky and the button to proceed isn't working. I'm hoping that when I find the source of this error, the rest will be fixed as well.
Thanks in advance for any advice offered! I'll greatly appreciate it.