Groups | Blog | Home
all groups > flash data integration > october 2006 >

flash data integration : Compare input text with imported XML data problem


Beppe_the_builder
10/5/2006 1:49:22 PM
I am making a simple quiz with the Q and As held in an external XML file.
I load the data and check it no problem and put the answer to the randomly
chosen question in a variable like this:
this["thisAnswer"] =
data.childNodes[0].childNodes[number].childNodes[1].childNodes[0];
I take input text from the user with a variable name myAnswer
I then compare the two to see if the answer is correct. The answers are simple
numbers from 1 to 10 while I test.
Even though I can output (trace) them and look at them and they are the same
(correct answer) this simple comparison does not work - why? The result is
always "You lose!"
Note: I have also tried using strings for the data and answer e.g. "nine"

myOpen.onPress = function() {
if (myAnswer == thisAnswer) {
myResult = "You win!";
trace("You win");
} else {
myResult = "You lose!";
trace("You lose");
}
};

Any help much appreciated.
AwesomeDigital
10/5/2006 2:59:22 PM
Darn I was about to try to help for once.

AddThis Social Bookmark Button