Hello guys!
I’m trying to figure out how to find the exact location of an XML item after I pushed it to an array…
I’m using this to find the item with the “fotoNR” number:
currentPic = "1111";
for (var i:Number = 0; i<numimages; i++) {
fotoNR = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
data = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
categoria = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
miniatura = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
imagem = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
descricao = xmlNode.childNodes*.childNodes[5].firstChild.nodeValue;
if(fotoNR == _root.currentPic){
myarray2.push({
fotoNR:fotoNR, data:data, categoria:categoria, miniatura:miniatura, imagem:imagem, descricao:descricao});
}
}
This is working… I can see the item that corresponds to the currentPic var / fotoNR node.
What I need to know is the location of it in the XML document!
I mean, if my XML looks like this:
<foto>
<fotoNR>112</fotoNR>
<data>03.03.2009</data>
<categoria>Misc</categoria>
<miniatura>galerias/Misc/miniaturas/shoe.jpg</miniatura>
<imagem>galerias/Misc/shoe.jpg</imagem>
<descricao><![CDATA[Shoe]]></descricao>
</foto>
<foto>
<fotoNR>1111</fotoNR>
<data>03.03.2009</data>
<categoria>BW</categoria>
<miniatura>galerias/BW/miniaturas/ZL3.jpg</miniatura>
<imagem>galerias/BW/ZL3.jpg</imagem>
<descricao><![CDATA[Z&L III]]></descricao>
</foto>
<foto>
<fotoNR>320</fotoNR>
<data>01.03.2009</data>
<categoria>Portraits</categoria>
<miniatura>galerias/Portraits/miniaturas/ZL4.jpg</miniatura>
<imagem>galerias/Portraits/ZL4.jpg</imagem>
<descricao><![CDATA[Z&L II]]></descricao>
</foto>
the item with fotoNR 1111 is the second (2) one…
But how do I find that by code?
Basically, I need to know how many items go from the beggining till the finded one!