Copy link to clipboard
Copied
Been at this for a while but having trouble achieving what I need.
All & any help would be wonderful!
Here's the scenario & what I would like to achieve:
On a frame named QUIZ, users need to select the 3 correct buttons out of 5 options, to move on to the next frame.
1. If any option buttons are selected, the selected buttons remain on a down state.
2. If SUBMIT button is selected, and buttons selected are wrong, go to frame named WRONG
3. If SUBMIT button is selected, and buttons selected are correct, go to frame named CORRECT
4. If RETRY button is selected, go to frame named QUIZ, all buttons that were selected should be cleared and user can redo the quiz
From this link I can managed to do item 1.
https://community.adobe.com/t5/animate-discussions/keep-button-state/m-p/10120114
Any guidance on how to achieve items 2-4 will be very much appreciated! Thank you in advance!
Copy link to clipboard
Copied
how many different questions are there?
if there's more than one, are they all presented on the same quiz frame or do you have different quiz frames?
Copy link to clipboard
Copied
Hi kglad! Thank you for your reply.
I would like have 3 questions in 1 frame like this:
Question 1: Choose 3 correct out of the 5 options below.
Answer1, Answer2, Answer3, Answer4, Answer5
Question 2: Choose 3 correct out of the 5 options below.
Answer1, Answer2, Answer3, Answer4, Answer5
Question 3: Choose 3 correct out of the 5 options below.
Answer1, Answer2, Answer3, Answer4, Answer5
SUBMIT RETRY
However if it is too complicated, I can also have 1 question per frame.
Eagerly awaiting your reply. Thank you!
Copy link to clipboard
Copied
if(!this.alreadyExecuted){
this.questionA=['question1', 'question2',question3'];
this.answerOptionsA=[['answer1 to q1','answer2 to q1',..,'answer5 to q1'],['answer1 to q2','answer2 to q2',etc],['answer1 to q3', etc]];
this.correctAnswerA=[[0,2,3],[1,3,4],[2,3,4]]; // the indices of the correct answers from this.answerOptionsA
this.questionNum=0;
this.alreadyExecuted=true;
}
// display question = this.questionA[this.questionNum)
// display answer1 = this.answerOptionsA[this.questionNum,0];
// display answer2 = this.answerOptionsA[this.questionNum,1];
// etc
this.submit.addEventListener("click",submitF.bind(this));
function submitF(){
var correctResponse = true;
for(var i=0;i<5;i++){
if(this.answerButton[i].currentLabel=='down'){ // name your answer buttons, answerButton0, answerButton1, etc and label your down frame, 'down'.
if(this.correctAnswerA[this.questionNum].indexOf(i)>-1){
// correct
} else {
// incorrect
correctResponse = false;
break;
}
} else {
// button up
if(this.correctAnswerA[this.questionNum].indexOf(i)>-1){
// incorrect
correctResponse = false;
break;
} else {
correct
}
}
}
if(correctResponse){
this.questionNum++;
if(this.questionNum==3){
// goto correct answer frame, but don't return here. quiz is over
} else {
goto correct answer frame
}
// go to incorrect answer frame. increment this.questionNum if they'll be presented with the next question, or do not if they have to retry getting this question answered correctly.
}
}
p.s. i didn't realize this was going to be so long when i started answering, so there's probably mismatched brackets in, at least, one location.
Copy link to clipboard
Copied
Hi kglad, thank you for this! Really appreciate your time.
I will try figure this out... Will update if I am successful.
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
Hi kglad, unfortunately I have not been successful thus far... 😞
Having significant issues so have decided to make things simpler.
I have attached a visual of the flow of what I would like to achieve.
Really hope you can provide me a working example or a simplified working version.
I can then extrapulate and take it from there.
Thank you in advance!
Details that go with the image below:
3 frames: QUIZ, CORRECT, WRONGRETRY
Frame1 - QUIZ: 3 questions, choose 1 answer each, Submit
Frame2 - CORRECT: When submit, checks if correct, goes to this frame
Frame3 - WRONGRETRY: When submit, checks if correct, if wrong, goes to this frame. Has a button to retry - which clears the selection & allows user to retry the quiz.
Copy link to clipboard
Copied
i usually limit free help to 5 to 10 minutes.
what you're asking (to create a working example), would take longer and i would charge money for that.
Copy link to clipboard
Copied
Yes I totally understand.
How much do you charge?
I would like to consider engaging your services.
Would you prefer we can continue this discussion through email?
Do let me know.
Copy link to clipboard
Copied
i replied to your private message.
Copy link to clipboard
Copied
oh wait, after agreeing to create your original quiz for a charge, i see your updated request is much simpler and doable in a few minutes (for free) and should be solvable here on the adobe forums.
so, what problem are your having with your updated (3 frame) quiz?
Copy link to clipboard
Copied
Thank you kglad, I would be very happy for your help!
Based on the simplified 3 frame quiz, these are the 3 issues I am having with my code:
1. Limiting the selection to 1 answer button for each question.
- My version currently allows me to select all 3 answer buttons.
2. Submit button doesn't work
- It auto detects if I click the correct answer buttons, without clicking the submit button, and goes to the "correct" frame if ONLY the correct answers are selected.
- If any wrong answers are selected, nothing happens.
3. Unable to reset the quiz
Not able to get this working.
Will await your reply. Thank you!