i file sono nella stessa cartella...
le action sono:
I frame
stop();
this._lockroot=true;
//fscommand ("allowscale", "false");
System.useCodepage = true;
filexml = "creaCombo.xml";
ApriXML();
function ApriXML () {
mioxml = new XML();
myarray = new Array();
mioxml.load(filexml)
mioxml.onLoad = ElaboraXML;
function ElaboraXML (success) {
if (mioxml.loaded) {
myarray = mioxml.childNodes;
Dati();
CreaCombo();
delete myarray;
delete mioxml;
}
};
};
// Funzione che prende i dati XML e li mette in degli Array
function Dati () {
// Array che contengono i Dati -----------------------
idItem = new Array();
item = new Array();
// ---------------------------------------------------
for (k=0; k<=myarray.length; k++) {
if (myarray[k].nodeName == "Nome") {
idItem.push(myarray[k].attributes.id);
} else if (myarray[k].nodeName == "item") {
item.push(myarray[k].childNodes.toString());
}
//trace(Dettaglio)
};
};
// funzione che mette i dati nella combo
function CreaCombo(){
trace(item)
prova.addItem("");
for (i=0; i<idItem.length; i++){
//prova.addItem(item[i]);
prova.addItem({data:idItem[i], label:item[i]});
}
}
listenerObject = new Object();
listenerObject.change = function(eventObject){
// Inserire qui il codice
var obj = prova.selectedItem;
trace("È stato selezionato il valore: " + obj.label);
trace("richiamo per la seconda combo il file xml "+obj.data)
chi=obj.data
//trace(selezione)
gotoAndStop(2);
}
prova.addEventListener("change", listenerObject)
II frame
stop();
System.useCodepage = true;
filexml1 = chi+".xml";
ApriXML1();
function ApriXML1 () {
_root.loading = "Connecting to Data Base for XML data...";
mioxml = new XML();
myarray = new Array();
mioxml.load(filexml1)
//mioxml.load(filexml + "&rnd=" + random(999999));
mioxml.onLoad = ElaboraXML;
function ElaboraXML (success) {
if (mioxml.loaded) {
myarray = mioxml.childNodes;
Dati1();
CreaCombo1();
delete myarray;
delete mioxml;
}
};
};
// Funzione che prende i dati XML e li mette in degli Array
function Dati1 () {
// Array che contengono i Dati -----------------------
idItem1 = new Array();
item1 = new Array();
// ---------------------------------------------------
for (k=0; k<=myarray.length; k++) {
if (myarray[k].nodeName == "Nome") {
idItem1.push(myarray[k].attributes.id);
} else if (myarray[k].nodeName == "item") {
item1.push(myarray[k].childNodes.toString());
}
//trace(Dettaglio)
};
};
// funzione che mette i dati nella combo
function CreaCombo1(){
trace(item1)
prova1.addItem("");
for (i=0; i<idItem1.length; i++){
prova1.addItem({data:idItem1[i], label:item1[i]});
}
}
listenerObject1 = new Object();
listenerObject1.change = function(eventObject){
// Inserire qui il codice
var obj = prova1.selectedItem;
trace("È stato selezionato il valore: " + obj.label);
trace("richiamo per la seconda combo il file xml "+obj.data)
selezione=obj.data
trace(selezione)
}
prova1.addEventListener("change", listenerObject1)
Mi questo errore
Error opening URL "file:///C|/Documents%20and%20Settings/Antonio/Desktop/combo/undefined.xml"
![]()