rendered paste bodyvar my_xml = new XML();
my_xml.ignoreWhite = true
var wordLength:Number = 0;
var randomNumber:Number = 0;
var theAnswer:String;
var aSound:Sound = new Sound();
my_xml.onLoad = function(success){
if (success){
theAnswer = my_xml.firstChild.childNodes[0].attributes.wordName;
trace(this.firstChild);
wordLength = this.firstChild.childNodes.length;
trace(my_xml.firstChild.childNodes.length)
//trace(node.attributes.wordFile)
//trace(node.attributes.wordName)
//_root["word"+i].text = node.attributes.wordName
}
}
my_xml.load("wordlist.xml");
ok.onRelease = function(){
if(this._parent.input.text == theAnswer){
gotoAndStop("correct");
randomNumber = random(wordLength);
trace(randomNumber);
theAnswer = my_xml.firstChild.childNodes[randomNumber].attributes.wordName;
} else {
gotoAndStop("wrong");
}
input.text = "";
}
audio.onRelease = function() {
aSound.loadSound(theAnswer+".mp3",true);
}