Hi, I need help with sorting out the lowest times (tid) and put them at the top of my scoreboard. All my scores are saved in a XML document and this is the code in the AS that puts the text into a textfield called “content_text”.
ShowNews = function(news_xml){
if (!news_xml.firstChild.hasChildNodes()){
content_txt.text = "No news available.";
return (0);
}
var entries = news_xml.firstChild.childNodes;
content_txt.text = "";
for (var i=0; i<entries.length; i++){
var title = GetTitleText(news_xml, i);
var tid = GetTidText(news_xml, i);
content_txt.htmlText += "<b>" + title +"</b><br>"
content_txt.htmlText += "Tid:" + tid +"<br>";
content_txt.htmlText += "----------------------------<br>"
}
And this is the code that fetches the info from the XML:
GetTidText = function(news_xml, entry_index){
var entries = news_xml.firstChild.childNodes;
var tid_element = entries[entry_index].firstChild.nextSibling.nextSibling.nextSibling.nextSibling;
return tid_element.firstChild.nodeValue;
}
Anyone know how to make it pick the ones with the lowest times and bring them to the top?