paulp75
asked on
preventing blank xml records outputting as undefined
in my xml file i have a part of it that goes like this
<store>
<name>Harvey Norman Outlets</name>
<address></address>
<suburb></suburb>
<postcode></postcode>
<phone></phone>
</store>
which when it is output through flash it outputs as
Harvey Norman Outlets
undefined
undefined
undefined
undefined
in the dynamic text. thanks to aneeshchopra ive got all the stores to output now, but now i'm just left with this one problem there.
this is the code in the flash file.
function loadXML(loaded) {
if (loaded) {
dB = new Array();
for(var i =0; i < xmlData.firstChild.childNo des.length ; i ++){
// this.firstChild.childNodes [] refers to which store record you refer to
// this.firstChild.childNodes [].ChildNo des[0] refers to the store name
// this.firstChild.childNodes [].ChildNo des[1] refers to the store address
// this.firstChild.childNodes [].ChildNo des[2] refers to the store suburb
// this.firstChild.childNodes [].ChildNo des[3] refers to the store phone
_root.presentation.Retaile rs.waslide .waholder. text += this.firstChild.childNodes [i].childN odes[0].fi rstChild.n odeValue + newline + this.firstChild.childNodes [i].childN odes[1].fi rstChild.n odeValue + newline + this.firstChild.childNodes [i].childN odes[2].fi rstChild.n odeValue + newline + this.firstChild.childNodes [i].childN odes[3].fi rstChild.n odeValue + newline + newline;
}
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("wa.xml");
thanks
<store>
<name>Harvey Norman Outlets</name>
<address></address>
<suburb></suburb>
<postcode></postcode>
<phone></phone>
</store>
which when it is output through flash it outputs as
Harvey Norman Outlets
undefined
undefined
undefined
undefined
in the dynamic text. thanks to aneeshchopra ive got all the stores to output now, but now i'm just left with this one problem there.
this is the code in the flash file.
function loadXML(loaded) {
if (loaded) {
dB = new Array();
for(var i =0; i < xmlData.firstChild.childNo
// this.firstChild.childNodes
// this.firstChild.childNodes
// this.firstChild.childNodes
// this.firstChild.childNodes
// this.firstChild.childNodes
_root.presentation.Retaile
}
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("wa.xml");
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
--trigger-happy