I am making a flash game, in each round, the player will chose either True or False. The decision of each round will be stored in an array. That is, it looks like {true, false, true, false}..
When the user clicks the "Debrief“ button, the eventlistener will be called and the game will go to the debriefing part. It will read the array mentioned before. However, the array values are all "false". I am very sure that the array has not being touched in between.
So, any ideas about why the array is set to false mysteriously?
Ok, the following is the code:
var answerArray:Array = new Array(); //global
//when user hit "Next", the answer of the current round will be saved.
function next (event:MouseEvent):void
{
answerArray.push(currentAnswer);
trace(answerArray); //at this point, the array is correct
//do some other stuff to goto the next round
}
function debrief(event:MouseEvent):void
{
trace(answerArray);
// do some other stuff
}
However, the trace in debrief() shows that all booleans in answerArray are False.I have tried to store integers in answerArray, however, all values become 0.