I’m using this code below to load xml data and display it in text fields, I was wondering if there was a way to load them in alphabetical order, based on the nodeValue of name?
stop();
function loadXML(true) {
if (true) {
xmlNode = this.firstChild;
name = [];
donation = [];
message = [];
attachLight();
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("lights.xml");
function attachLight() {
total = (xmlNode.childNodes.length);
//For loop to attach our container movieclip and pass the xml information
var xPos = 0;
var yPos = 0;
for(i=0;i<total;i++){
//define xml
**name*** = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
[COLOR="DarkOrange"]// need to somehow sort this value alphabetically[/COLOR]
donation* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
message* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
//attach container clip
currMovie = attachMovie("light", "xml"+i, i, {_x:xPos, _y:yPos});
xPos += currMovie._width - 250;
//add text to text boxes
currMovie.name_txt.text = name*;
currMovie.donation_txt.text = "$" + donation*;
currMovie.message_txt.text = message*;
}