Copy link to clipboard
Copied
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();
use:
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;
function correct(event:MouseEvent):void {
gotoAndStop(64);
}
function wrong(event:MouseEvent):void {
count++;
gotoAndStop(68);
}
stop();
code in Frame 68
next_q.addEventListener(MouseEvent.CLICK, nextAsk);
retry_btn.addEventListener(MouseEvent.CLICK, retry);
function nex
...Copy link to clipboard
Copied
when the answer's wrong, you go to frame 68, not 64. it's not clear what's on frame 68 but obviously that's the issue.
Copy link to clipboard
Copied
Check again. The retry_btn is in frame 68.
Copy link to clipboard
Copied
when on frame 61
if you answer correctly and then click retry does your app work as expected?
if you answer incorrectly and then click retry does your app work as expected?
Copy link to clipboard
Copied
My next_q button to go next question is working. But i want to give a second chance if i get the wrong answer to try again, but only once in every question.
For retry_btn i don't know how i can to do to work.
Copy link to clipboard
Copied
use:
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;
function correct(event:MouseEvent):void {
gotoAndStop(64);
}
function wrong(event:MouseEvent):void {
count++;
gotoAndStop(68);
}
stop();
code in Frame 68
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();
Copy link to clipboard
Copied
I find it...Thanks for help!
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:int;
function correct(event:MouseEvent):void
{
gotoAndStop(64);
}
function wrong(event:MouseEvent):void
{
count++;
if(count == 1)
{
gotoAndStop(67);
} else {
gotoAndStop(70);
}
}
stop();
Frame 64:
next_q.addEventListener(MouseEvent.CLICK, nextAsk);
function nextAsk(event:MouseEvent):void
{
gotoAndStop(73);
}
stop();
Frame 67:
retry_btn.addEventListener(MouseEvent.CLICK, retryAsk);
function retryAsk(event:MouseEvent):void
{
gotoAndPlay(61);
}
stop();
Frame 70:
next_q2.addEventListener(MouseEvent.CLICK, lostAsk);
function lostAsk(event:MouseEvent):void
{
gotoAndStop(73);
}
stop();
Copy link to clipboard
Copied
you're welcome.