ceduardo
10-02-2009, 05:35 AM
Hi every body, I sorry but my english is very bad, I am new with AS2, I am learnig to make games.
I want to know, Write and Read XML files for store the users names and yous scores.
I am doing this for read
var xmlScores = new XML();
xmlScores.ignoreWhite = true;
xmlScores.onLoad = function(success){
if(success){
var root = this.firstChild
nodes = root.childNodes
for(var i=0; i<nodes.length; i++) {
subnodes = nodes[i].childNodes;
_root.scores += "<th>" + subnodes[0].firstChild.toString() + "</th>";
_root.scores += "<th>" + subnodes[1].firstChild.toString() + "</th>";
_root.scores += "<th>" + subnodes[2].firstChild.toString() + "</th>";
}//for(var i=0; i<nodes.length; i++)
}//if(success)
}
xmlScores.load("scores.xml");
xmlScores.ref = this;
But I doŽnt know how write the new users and scores on the xml file.
thanks for your help
I want to know, Write and Read XML files for store the users names and yous scores.
I am doing this for read
var xmlScores = new XML();
xmlScores.ignoreWhite = true;
xmlScores.onLoad = function(success){
if(success){
var root = this.firstChild
nodes = root.childNodes
for(var i=0; i<nodes.length; i++) {
subnodes = nodes[i].childNodes;
_root.scores += "<th>" + subnodes[0].firstChild.toString() + "</th>";
_root.scores += "<th>" + subnodes[1].firstChild.toString() + "</th>";
_root.scores += "<th>" + subnodes[2].firstChild.toString() + "</th>";
}//for(var i=0; i<nodes.length; i++)
}//if(success)
}
xmlScores.load("scores.xml");
xmlScores.ref = this;
But I doŽnt know how write the new users and scores on the xml file.
thanks for your help