This is the code i am using to read an xml document.
GetTitleText = function(news_xml, entry_index){
var entries = news_xml.firstChild.childNodes;
var title_element = entries[entry_index].firstChild;
return title_element.firstChild.nodeValue;
}
GetBodyText = function(news_xml, entry_index){
var entries = news_xml.firstChild.childNodes;
var body_element = entries[entry_index].firstChild.nextSibling;
return body_element.firstChild.nodeValue;
}
GetEntry = function(news_xml, index){
var entries = news_xml.firstChild.childNodes;
return entries[index];
}
GetNewsCount = function(news_xml){
var entries = news_xml.firstChild.childNodes;
return entries.length;
}
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 body = GetBodyText(news_xml, i);
content_txt.htmlText += "<b>" + title +"</b><br>"
content_txt.htmlText += body +"<br><br>";
}
}
RefreshNews = function(news_xml){
content_txt.htmlText = "<i>Loading...</i>";
news_xml.load(xml_file);
}
var xml_file = "news.xml";
var news_xml = new XML();
news_xml.ignoreWhite = true;
news_xml.contentType = "text/xml";
news_xml.onLoad = function(success){
if (success) ShowNews(this);
else content_txt.text = "Error loading XML file";
}
RefreshNews(news_xml);
and it works great. however when i try to add a UI scroll bar, the scroll bar does not work. Any sugestions?