Hallo,
ich rufe einen Feed mit folgendem Code ab. Meine Frage, muss ich den setInterval noch beenden und/oder anders setzen? Vermute durch merkwürdige Serverlast, dass ich einen Fehler gemacht habe. Wäre dankbar für Rat.
// ***********************************************
var rss_css:TextField.StyleSheet = new TextField.StyleSheet();
rss_css.onLoad = function(success:Boolean) {
if (success) {
trace ("css loaded...");
}
};
rss_css.load("file.css");
// ************************************************
onLoad=function(){
clearInterval(loadDATA)
loadDATA();
}
function loadDATA(){
var rss_xml:XML = new XML();
rss_xml.ignoreWhite = true;
rss_xml.onLoad = function(success:Boolean) {
if (success) {
processData(rss_xml);
setInterval(loadDATA, 120000);
trace ("intervall start...");
} else {
trace("unable to load/parse");
}
};
rss_xml.load('feed.xml');
}
// ***********************************************
// Process Data
// ***********************************************
channel_title = "";
channel_desc = "";
channel_copyright = "";
channel_link = "";
channel_lang = "";
function processData(rm){
var rss = rm.firstChild.firstChild;
item_txt.text="";
item_txt.html = true;
item_txt.styleSheet = rss_css;
for (i=0;i<rss.childNodes.length;i++){
//trace(rss.childNodes[i].nodeName);
if (rss.childNodes[i].nodeName == "title"){
channel_title = rss.childNodes[i].firstChild.nodeValue;
}else if (rss.childNodes[i].nodeName == "description"){
channel_description = rss.childNodes[i].firstChild.nodeValue;
}else if (rss.childNodes[i].nodeName == "copyright"){
channel_copyright = rss.childNodes[i].firstChild.nodeValue;
}else if (rss.childNodes[i].nodeName == "link"){
channel_link = rss.childNodes[i].firstChild.nodeValue;
}else if (rss.childNodes[i].nodeName == "language"){
channel_lang = rss.childNodes[i].firstChild.nodeValue;
}else if (rss.childNodes[i].nodeName == "image"){
var sTitle;
var sLink; // link
var sURL; // logo url
txtLogo.html = true;
txtLogo.htmlText="";
for (j=0;j<rss.childNodes[i].childNodes.length;j++){
if (rss.childNodes[i].childNodes[j].nodeName == "title"){
sTitle = rss.childNodes[i].childNodes[j].firstChild.nodeValue;
}else if (rss.childNodes[i].childNodes[j].nodeName == "link"){
sLink = rss.childNodes[i].childNodes[j].firstChild.nodeValue;
}else if (rss.childNodes[i].childNodes[j].nodeName == "url"){
sURL = rss.childNodes[i].childNodes[j].firstChild.nodeValue;
}
}
}else if (rss.childNodes[i].nodeName == "item"){
var itemTitle;
var itemDesc;
var itemLink;
for (j=0;j<rss.childNodes[i].childNodes.length;j++){
if (rss.childNodes[i].childNodes[j].nodeName == "title"){
itemTitle = rss.childNodes[i].childNodes[j].firstChild.nodeValue;
}else if (rss.childNodes[i].childNodes[j].nodeName == "description"){
itemDesc = rss.childNodes[i].childNodes[j].firstChild.nodeValue;
}else if (rss.childNodes[i].childNodes[j].nodeName == "link"){
itemLink = rss.childNodes[i].childNodes[j].firstChild.nodeValue;
}
}
item_txt.htmlText += "<a href=\"" + itemLink + "\" >" + itemTitle + "</a><br><span class=\"thread\">" + itemDesc + "</span><br><span class=\"thread\">"
}
}
}