anyone!!help me!!
this is driving me insane!!!
i got this error
Cannot access a property or method of a null object reference.
whenever I clicked on my button
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at test_fla::MainTimeline/onClick()
I know it means that the onClick is not on the stage,but I do put my buttons all in the same frame with the actionscript
here is my full actionscript,simple switch case
stop();
play_btn.addEventListener(MouseEvent.CLICK, onClick);
instruction_btn.addEventListener(MouseEvent.CLICK, onClick);
option_btn.addEventListener(MouseEvent.CLICK, onClick);
score_btn.addEventListener(MouseEvent.CLICK, onClick);
quit_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void {
switch (evt.target) {
case play_btn :
trace("play");
content_mc.gotoAndPlay("play");
break;
case instruction_btn :
content_mc.gotoAndPlay("instruction");
break;
case option_btn :
content_mc.gotoAndPlay("option");
break;
case score_btn :
content_mc.gotoAndPlay("score");
break;
case quit_btn :
fscommand("quit");
break;
}
}
the trace can works but not the link
i’m desperate :’(