Hi there…i want to modify this code so that i can only show news items that are in a particular category…
here is my a/s
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
articleTitle = [];
articleContents = [];
articleDate = [];
articleCategory = [];
articleLink = [];
total = xmlNode.childNodes.length;
trace(total);
r = 0;
for (i=0; i<total; i++) {
if(xmlNode.childNodes*.childNodes[3].firstChild.nodeValue == "Sharepoint"){
trace(r);
articleTitle* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
articleContents* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
articleDate* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
articleCategory* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
articleLink* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
}else
{
r++;
}
}
total = (total-r);
first_item();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news.xml");
//
function first_item() {
delay = 5000;
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;
//
titleMC.title_txt._alpha = 100;
titleMC.title_txt.text = articleTitle[pos];
contentMC.content_txt._alpha = 100;
contentMC.content_txt.text = articleContents[pos];
dateMC.date_txt._alpha = 100;
dateMC.date_txt.text = articleDate[pos];
fadein();
titleMC.onRelease = function() {
getURL(articleLink[pos], "_self");
};
titleMC.onRollOver = function() {
this.title_txt.setTextFormat(over);
this.title_txt.setTextFormat(bolda);
};
titleMC.onRollOut = function() {
this.title_txt.setTextFormat(out);
};
timer();
}
function fadein() {
this.onEnterFrame = function() {
if (titleMC.title_txt._alpha < 100) {
titleMC.title_txt._alpha += 5;
contentMC.content_txt._alpha += 5;
dateMC.date_txt._alpha += 5;
} else {
display(p);
p++;
delete this.onEnterFrame;
}
};
}
function fadeout() {
this.onEnterFrame = function() {
if (titleMC.title_txt._alpha>=0) {
titleMC.title_txt._alpha -= 5;
contentMC.content_txt._alpha -= 5;
dateMC.date_txt._alpha -= 5;
} else {
display(p);
p++;
delete this.onEnterFrame;
}
};
}
and my XML
<?xml version="1.0"?>
<newsitems>
<article>
<name>Article Name Sharepoint</name>
<contents>11111This is the article Contents This is the article contents.</contents>
<date>12th January 2008</date>
<category>Sharepoint</category>
<link>http://www.google.co.uk</link>
</article>
<article>
<name>Article Name 2</name>
<contents>222222This is the article Contents This is the article contents. 222222This is the article Contents This is the article contents. 222222This is the article Contents This is the article contents.</contents>
<date>13th January 2008</date>
<category>BizTalk</category>
<link>http://www.google.co.uk</link>
</article>
<article>
<name>Article Name 3</name>
<contents>33333This is the article Contents This is the article contents.</contents>
<date>14th January 2008</date>
<category>Sharepoint</category>
<link>http://www.google.co.uk</link>
</article>
</newsitems>
you can see how i have done it so far but the new ticker still shows all items as undefined and others which do validate as the correct info…how do i get it to just show the items i want.
Thanks
Rodent