[LEFT]Hi, I do not have much knowledge with xml, I have two fields, one for items and other values, I want to show the total of each field.
[LEFT]I’m using a model of the gallery’s xml kirupa tutorials.
The XML:
<images>
<pic>
<itens>1</itens>
<valor>12,55</valor>
</pic>
<pic>
<itens>2</itens>
<valor>65,88</valor>
</pic>
</images>
The AS:
stop();
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
itens = [];
valor = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
itens* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
valor* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
picture_num();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
function picture_num() {
pos_txt.text = current_pos+" / "+total;
itens_txt.text = itens[0] + itens[0];
valor_txt.text = valor[1] + valor[1];
}
I want to add the values.
The itens field need to show: 3
The Price field need to show: 78,43
but now they are showing:
The itens field need to show: 11
The Price field need to show: 65,8865,88
Somebody can help me?
Sorry about my English.
[/LEFT]
[/LEFT]