Hi,
I need to reload XML data in Flash as soon as the XML has been updated from back-end.
I have gone through News Ticker Tutorial and It Worked fine.
Here is the link of that tutorial for your reference: http://www.kirupa.com/developer/mx2004/newsticker.htm
I customized the code little bit (am not a flash developer :(). In the timer function, I put the xmlData.load… in order to reload the file. Luckily it worked but still didn’t fulfil my requirement. When the condition p==total fulfils, it reloads the XML file but fade-in and fadeout the first displayed news very quickly, without any delay and rest of the news works fine. I have spent days to resolve this issue but in vain. Plzzzzzzzzzzzzz help me out. Here is the modification in red colour.
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
caption = [];
detail = [];
from = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
caption* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
detail* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
from* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
first_item();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("Z:/news_ho.xml?blarg=" + new Date().getTime());
function first_item() {
delay = 3000;
p = 0;
display(p);
p++;
}
function timer() {
myInterval = setInterval(ticker, delay);
function ticker() {
clearInterval(myInterval);
if (p == total) {
[COLOR=#ff0000]**xmlData.load("Z:/news_ho.xml?blarg=" + new Date().getTime());**[/COLOR]
p = 0;
}
fadeout();
}
}
function display(pos) {
over = new TextFormat();
over.underline = true;
//
out = new TextFormat();
out.underline = false;
//
TitleMC.newsTitle._alpha = 100;
TitleMC.newsTitle.text = caption[pos];
newsMC.newsText._alpha = 100;
newsMC.newsText.text = detail[pos];
PostedMC.Postedtxt._alpha = 100;
PostedMC.Postedtxt.text = from[pos];
timer();
}
function fadeout() {
this.onEnterFrame = function() {
if (newsMC.newsText._alpha>=0) {
newsMC.newsText._alpha -= 5;
TitleMC.newsTitle._alpha -= 5;
PostedMC.Postedtxt._alpha -= 5;
} else {
display(p);
p++;
delete this.onEnterFrame;
}
};
}
Thanks,
Abdul