AS3: Timeline navigation with gotoAndStop(); throws unexpected null object error
Here's my code. It seems I can't address the stage. I get a null object reference error at gotoAndStop(3);
private function exitInvitation(e: MouseEvent😞 void {
simpleBack.removeEventListener(MouseEvent.CLICK, exitInvitation);
removeChild(simpleBack);
gotoAndPlay(3);
}
I'm moving from frame 10 to frame 3. This is clearly a bug. Not even code written on the timeline works. What do I have to listen for to know that my stage object is available?
I've tried adding:
addEventListener(Event.ADDED_TO_STAGE, init);
private function init(e:Event😞void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
gotoAndPlay(3);
}
Sadly, it doesn't work. I have no idea why other buttons work in my AIR app, but this doesn't. Why is frame 3 null?