Hi!
I have been building a topten for a tetris. For some wierd reason the code wont take the score and check it at the if -statement. Heres the code:
// *******************************************************
// Checking the highscore and if score (punkte) higher than 10th go->
// *******************************************************
function loadXML(loaded) {
if (loaded) {
// Load 10 th place from the xml file
punkte2 = this.firstChild.childNodes[9].childNodes[1].firstChild.nodeValue;
comment_txt10.text = punkte2;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("/topten/topten.xml");
// Check if the played score (punkte) is greater than the 10th place (punkte2)
if (punkte > punkte2) {
// If yes, go to the topten writing procedure = give name
trace("highscore");
gotoAndStop(78);
} else {
// If no, go to the game over -page
trace("sorry try again!");
play();
}
For some reason the if -statement wont work. It gets the valkues right from the played score and the 10th place points (tested it with dynamic text boxes). But it wont pass the value to the if statement, its allways a highscore result…
Any help is really much appreciated