premessa: penso che il codice AS scritto per flash sia valido anche su swishmax...
in AS non è possibile scrivere un array in quel modo, l'unica è di accedere direttamente all'array utilizzando un Object che contenga gli elementi, poi al massimo puoi fare un if in cui verifichi l'id e in base a quello tracci gli elementi
io nel tuo caso farei così
Codice PHP:
function useArray(a) {
for (var j = 0; j<a.length; j++) {
trace("id: "+a[j].id);
trace("struttura: "+a[j].struttura);
trace("approvato: "+a[j].approvato);
trace("livello: "+a[j].livello);
}
}
var myarray = new Array();
var myxml = new XML();
myxml.ignoreWhite = true;
myxml.onLoad = function(success) {
if (this.loaded) {
var temp = this.firstChild.firstChild.childNodes;
for (var i = 0; i<temp.length; i++) {
myarray.push({id:temp[i].childNodes[0].firstChild.toString(), struttura:temp[i].childNodes[1].firstChild.toString(), approvato:temp[i].childNodes[2].firstChild.toString(), livello:temp[i].childNodes[3].firstChild.toString()});
}
useArray(myarray);
} else {
trace("Fault to load file_ext.xml");
}
};
myxml.load("file_ext.xml");
in pratica nella funzione useArray fai tutto quello che vuoi con il tuo array richiamandolo come parametro della funzione stessa
il parsing esegue un push di un oggetto che contiene le proprietà corrispondenti ai nodi di ogni "record"
se devi fare come volevi, dovresti fare così
Codice PHP:
if(a[j].id == 1){
trace(a[j].struttura); // output: ddd#dddd#ddd#ddd
}
edit: ciao nega