bryceww
March 26th, 2008, 11:09 PM
Hi, how can i refresh my xml data? Im using the following.
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
songTitle = xmlNode.childNodes[8].childNodes[0];
songTitle = songTitle_txt.text.toUpperCase();
songTitle = songTitle_txt.text.searchReplace(" - ", ": ");
songTitle_txt.autoSize = true;
buy_mc._x = songTitle_txt._x+songTitle_txt._width+5;
buy_mc._y = songTitle_txt._y;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://www.crylounge.com/shoutcast.php");
String.prototype.searchReplace = function(str, rep, chr) {
var t = (chr<0) ? this.substr(chr) : this.substr(0, chr);
var s = str.length;
var r = rep.length;
var p = t.indexOf(str);
while (p != -1) {
t = t.substr(0, p)+rep+t.substr(p+s);
p = t.indexOf(str, p+r);
}
return (chr) ? (chr<0) ? this.substr(0, this.length+chr)+t : t+this.substr(chr) : t;
};
Thanks, Bryce
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
songTitle = xmlNode.childNodes[8].childNodes[0];
songTitle = songTitle_txt.text.toUpperCase();
songTitle = songTitle_txt.text.searchReplace(" - ", ": ");
songTitle_txt.autoSize = true;
buy_mc._x = songTitle_txt._x+songTitle_txt._width+5;
buy_mc._y = songTitle_txt._y;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://www.crylounge.com/shoutcast.php");
String.prototype.searchReplace = function(str, rep, chr) {
var t = (chr<0) ? this.substr(chr) : this.substr(0, chr);
var s = str.length;
var r = rep.length;
var p = t.indexOf(str);
while (p != -1) {
t = t.substr(0, p)+rep+t.substr(p+s);
p = t.indexOf(str, p+r);
}
return (chr) ? (chr<0) ? this.substr(0, this.length+chr)+t : t+this.substr(chr) : t;
};
Thanks, Bryce