Hi there,
I am little bit stuck here. I got the following:
1 xml -file, like
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>Wyona Ryder</item>
<item>Uma Thurman</item>
<item>Tom Cruise</item>
<items>
2 i have succesfull parse the xml file in flash and got them in a pull-down menu.
3 a user can select a name.
My problem: I can trace the chosen name, but i want the corresponding XML node as a var?
That’s if the user selects Uma Thurman the corresponding XML node is 1, so how do i accomplish this?
I am trying to make a ‘getSelectXMLnode’ function, the parse function works properly
//parse xml file
function parseCelebs () {
if (_root.xmlDocument.loaded) {
for (var i = 0; i < _root.xmlDocument.childNodes.length; i++) {
if (_root.xmlDocument.childNodes*.nodeName == 'items') {
// _root.Celebs = this.childNodes*;
var cookieNodes = _root.xmlDocument.childNodes*.childNodes;
for (var j = 0; j < cookieNodes.length; j++) {
if (cookieNodes[j].nodeName == 'item') {
_root.Celebs[_root.Celebs.length] = cookieNodes[j].firstChild.nodeValue;
_root.vips = cookieNodes[j].firstChild.nodeValue;
//check if all celebs //trace (_root.vips);
}
}
break;
}
}
// trace (_root.Celebs.length);
// we need # of celebs for the pull-down
noCelebs = _root.Celebs.length;
_root.xmlDocument = null;
}
}
function getSelectXMLnode () {
//for debug we use static value of 3 and tom cruise
for (var k = 0; k < 3; k++) {
if (cookieNode[k].firstChild.nodeValue == 'tom cruise') {
trace (k);
}
}
Thnks in advanced.