Actionscript Code:quizItems[i]=new QuizItem(questionNode.firstChild.nodeValue);
You are calling QuizItem function BEFORE updating wrongresponse with the value fetched from the XML file, hence the first node is 'undefined', and the second one is equals to the first one's wrong response.
To solve this, add a new parameter to QuizItem:
Actionscript Code:function QuizItem(question, wrong_response)
and then change, this.wrongresponse=wrongreponse; to this:
Actionscript Code:this.wrongresponse=wrong_response;
then find this line:
and change it to this:Code:quizItems[i]=new QuizItem(questionNode.firstChild.nodeValue);
Actionscript Code:quizItems[i]=new QuizItem(questionNode.firstChild.nodeValue, itemNode.childNodes[5].firstChild.nodeValue);
and lastly, just remove this line:
Code:wrongresponse=itemNode.childNodes[5].firstChild.nodeValue;




... and finally 18 :P
Reply With Quote