Copy link to clipboard
Copied
stop();
var Mark:int = 0;
btn_start.addEventListener(MouseEvent.CLICK, startquiz);
function startquiz(e:MouseEvent) : void {
gotoAndStop("q1")
}
function right_ans(next_question:String) : Function {
return function(e:MouseEvent) : void{
Mark++;
gotoAndStop(next_question);
}
}
function wrong_ans(next_question:String) : Function {
return function(e:MouseEvent) : void{
gotoAndStop(next_question);
}
}
Copy link to clipboard
Copied
why are you returning a function instead of using:
function right_ans(next_question:String) : void {
Mark++;
gotoAndStop(next_question);
}
function wrong_ans(next_question:String) : void {
gotoAndStop(next_question);
}
Copy link to clipboard
Copied
Cause i put code for the question in the next frame.
q1_r.addEventListener(MouseEvent.CLICK, right_ans("q2"));
q1_w0.addEventListener(MouseEvent.CLICK, wrong_ans("q2"));
q1_w1.addEventListener(MouseEvent.CLICK, wrong_ans("q2"));
q1_w2.addEventListener(MouseEvent.CLICK, wrong_ans("q2"));
removing the return function breaks it
Scene 1, Layer 'AS3', Frame 332, Line 1, Column 41 1067: Implicit coercion of a value of type void to an unrelated type Function.
Copy link to clipboard
Copied
what code are you using that triggered that 1067 error message?