Tokidoki
06-18-2008, 09:36 PM
I'm trying to make an interactive quiz. depending on what the answers is chosen, itll bring to a another specific question. Each answer has a certain value (1,2,3,4,5,etc)
and I record the value via xml through this code
arrAGoTo[i] = new Array();
for (j=0; j<dataXML.question[i].answers.length(); j++) {
arrAGoTo[i][j] = dataXML.question[i].answers[j].@goTo.toString();
}
so as you can see all the value is recorded at:
arrAGoTo[i][j]
i being the question number and j being the answer selected
it will then be passed to the following function as:
arrAGoTo[index-1][rbg.selectedData]
btnCheck.addEventListener(MouseEvent.CLICK, chkAnswer);
function chkAnswer(mevt:MouseEvent):void {
index=index+arrAGoTo[index-1][rbg.selectedData];
trace(arrAGoTo[index-1][rbg.selectedData]);
setup();
}
the trace for arrAGoTo[index-1][rbg.selectedData] works. It gives the value that I want on the output window. but when I assign it to index, it gives me the following error message:
TypeError: Error #1010: A term is undefined and has no properties.
at oce_coding_experiment_v1_fla::MainTimeline/chkAnswer()
Help!
and I record the value via xml through this code
arrAGoTo[i] = new Array();
for (j=0; j<dataXML.question[i].answers.length(); j++) {
arrAGoTo[i][j] = dataXML.question[i].answers[j].@goTo.toString();
}
so as you can see all the value is recorded at:
arrAGoTo[i][j]
i being the question number and j being the answer selected
it will then be passed to the following function as:
arrAGoTo[index-1][rbg.selectedData]
btnCheck.addEventListener(MouseEvent.CLICK, chkAnswer);
function chkAnswer(mevt:MouseEvent):void {
index=index+arrAGoTo[index-1][rbg.selectedData];
trace(arrAGoTo[index-1][rbg.selectedData]);
setup();
}
the trace for arrAGoTo[index-1][rbg.selectedData] works. It gives the value that I want on the output window. but when I assign it to index, it gives me the following error message:
TypeError: Error #1010: A term is undefined and has no properties.
at oce_coding_experiment_v1_fla::MainTimeline/chkAnswer()
Help!