Hi all
The code below will track how many questions were answered right and wrong and it works great, however I want to trap which question the user missed and compile a list of the questions missed. I know it lies in this section of the code but how would I tie the variable userAnswerNumber to the question and have a list of all questions missed?
[as]
if (userAnswerNumber==this.getCorrectAnswerNumber())
gotoAndPlay("Correct");
else
gotoAndPlay("Wrong");
[/as]
Here is the all the code for your reference.
Thanks
[as]
function QuizItem(question)
{
this.question=question;
this.answers=new Array();
this.numOfAnswers=0;
this.correctAnswer=0;
this.getQuestion=function()
{
return this.question;
}
this.addAnswer=function(answer, isCorrectAnswer)
{
this.answers[this.numOfAnswers]=answer;
if (isCorrectAnswer)
this.correctAnswer=this.numOfAnswers;
this.numOfAnswers++;
}
this.getAnswer=function(answerNumberToGet)
{
return this.answers[answerNumberToGet];
}
this.getCorrectAnswerNumber=function()
{
return this.correctAnswer;
}
this.checkAnswerNumber=function(userAnswerNumber)
{
if (userAnswerNumber==this.getCorrectAnswerNumber())
gotoAndPlay("Correct");
else
gotoAndPlay("Wrong");
}
this.getNumOfAnswers=function()
{
return this.answers.length;
}
}
[/as]
The code below will track how many questions were answered right and wrong and it works great, however I want to trap which question the user missed and compile a list of the questions missed. I know it lies in this section of the code but how would I tie the variable userAnswerNumber to the question and have a list of all questions missed?
[as]
if (userAnswerNumber==this.getCorrectAnswerNumber())
gotoAndPlay("Correct");
else
gotoAndPlay("Wrong");
[/as]
Here is the all the code for your reference.
Thanks
[as]
function QuizItem(question)
{
this.question=question;
this.answers=new Array();
this.numOfAnswers=0;
this.correctAnswer=0;
this.getQuestion=function()
{
return this.question;
}
this.addAnswer=function(answer, isCorrectAnswer)
{
this.answers[this.numOfAnswers]=answer;
if (isCorrectAnswer)
this.correctAnswer=this.numOfAnswers;
this.numOfAnswers++;
}
this.getAnswer=function(answerNumberToGet)
{
return this.answers[answerNumberToGet];
}
this.getCorrectAnswerNumber=function()
{
return this.correctAnswer;
}
this.checkAnswerNumber=function(userAnswerNumber)
{
if (userAnswerNumber==this.getCorrectAnswerNumber())
gotoAndPlay("Correct");
else
gotoAndPlay("Wrong");
}
this.getNumOfAnswers=function()
{
return this.answers.length;
}
}
[/as]