Hey everyone, I’m having a little trouble here…I’m trying to make roster* contain all of the childNodes in the rHolder, which is the entire xml document but the program never gets to the for loop below, so whenever the button is pressed for the search() function, it doesn’t find anything because the roster array isnt containing anything in the begining and I can’t seem to figure out why
Any help would be appreciated please below the actionscript file is an example of my xml file
myxml = new XML();
myxml.onLoad = function(success) {
if (success) {
rHolder = myxml.firstChild.childNodes;
roster = new Array();
//the below for loop just crashes the program every time i try to debug
for (i=0; i<rHolder.length; i++) {
roster* = rHolder*.childNodes;
}
}
};
myxml.load("roster.xml");
this.onEnterFrame = function() {
var loadedBytes = myxml.getBytesLoaded();
var totalBytes = myxml.getBytesTotal();
var bytes = Math.floor(loadedBytes/1024*1000);
var percentLoaded = Math.floor(loadedBytes/totalBytes*100);
_root.loading.text = percentLoaded+" %";
if (loadedBytes>=totalBytes) {
percentLoaded = 101;
}
};
search_btn.onPress = function() {
_root.search();
};
function search() {
thissearch = input.text;
for (i=0; i<roster.length; i++) {
if (roster*[3].firstChild.nodeValue == thissearch) {
trace("loop");
for (j=0; j<4; j++) {
trace(roster*[j].firstChild);
}
}
}
}
<rosterlist>
<roster>
<division>csim</division>
<userid>94704</userid>
<teamid>401</teamid>
<uniqueid>0:1:2273</uniqueid>
</roster>
<roster>
<division>csim</division>
<userid>54</userid>
<teamid>263</teamid>
<uniqueid>0:0:3441256</uniqueid>
</roster>
</rosterlist>