PDA

View Full Version : Help on News Ticker



mjmdotorg
January 24th, 2007, 01:36 AM
Hi Everyone!

I just want to know if somebody can help I was doing the news ticker tutorial in my site but the problem is it only show one item on my xml file, im using the file http://www.kirupa.com/modular/kirupa.xml

not the one that was in the exact tutorials, can anybody here knows what should i change in my actionscript below:


function loadXML(loaded)
{
if (loaded)
{ xmlNode = this.firstChild;
caption = [];
desc = [];
url = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++)
{
caption[i] = xmlNode.childNodes[i].childNodes [0].firstChild.nodeValue;
desc[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
url[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
}
first_item();
} else
{ content = "file not loaded!"; }
}
xmlData = new XML();
xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("http://www.kirupa.com/modular/kirupa.xml?blarg="+new Date().getTime());
// function first_item()
{
delay = 1000;
p = 0;
display(p); p++;
}
function timer()
{
myInterval = setInterval(ticker, delay);
function ticker()
{
clearInterval(myInterval);
if (p == total)
{
p = 0;
}
fadeout();
}
}
function display(pos)
{
over = new TextFormat();
over.underline = true;
//
out = new TextFormat();
out.underline = false;
//
newsMC.newsText._alpha = 100;
newsMC.newsText.text = caption[pos]+"\n"+desc[pos]; newsMC.onRelease = function()
{ getURL(url[pos], "_self"); }; newsMC.onRollOver = function() { this.newsText.setTextFormat(over); }; newsMC.onRollOut = function() { this.newsText.setTextFormat(out); }; timer(); } function fadeout() { this.onEnterFrame = function() { if (newsMC.newsText._alpha>=0) { newsMC.newsText._alpha -= 5; } else { display(p); p++; delete this.onEnterFrame; } }; }

so that it show all the items in the xml file.

Thanks in advance,
mjmdotorg