Quiz - Retry Action with Counter and If statement
Hi Happy Easter!
I want to make a counter for a Quiz I'm preparing. I want to do this in Frame, where the wrong answer to the question will be given, (Frame 61) becomes the 1st counter of 0. And in the frame that shows the result, that is, that the answer is wrong (Frame 64), I want press a (Retry) button and return to the original Frame of Question (Frame 61). If you can help me. (I have no errors)
My code in Frame 61:
btn_a.addEventListener(MouseEvent.CLICK, correct);
btn_b.addEventListener(MouseEvent.CLICK, wrong);
btn_c.addEventListener(MouseEvent.CLICK, wrong);
btn_d.addEventListener(MouseEvent.CLICK, wrong);
var count = 0;
function correct(event:MouseEvent):void {
gotoAndStop(64);
}
function wrong(event:MouseEvent):void {
gotoAndStop(68);
count = 1;
}
stop();
My code in Frame 64:
next_q.addEventListener(MouseEvent.CLICK, nextAsk);
retry_btn.addEventListener(MouseEvent.CLICK, retry);
function nextAsk(event:MouseEvent):void {
gotoAndStop(72);
}
function retry(event:MouseEvent):void {
if(count == 1) {
gotoAndPlay(61);
} else {
gotoAndStop(72);
}
}
stop();
