Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trapping Quiz response variables

Status
Not open for further replies.

GeeBee2

Technical User
Aug 29, 2005
12
US
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top