Hello,
I am very glad i found the great tutorial how to make a newsticker.
I got i working so im very proud of myself, even if i was only pasting some code in flash :bucktooth: But unfortunately the xml doc where i have to get the info from is pretty complex.
[COLOR=blue]<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?>
<rss version=“2.0”>
<channel>
<title>blablabla</title>
<link>blablabla</link>
<description>blablabla.</description>
<ttl>60</ttl>
<language>blabla</language>
<generator>blablae</generator>
<managingEditor>redactie@blabla.com</managingEditor>
<webMaster>info@blabla.com</webMaster>
<copyright>Copyright 2000-2005, blabla</copyright>
<image>
<url>http://blabla.com/img/lg_home.gif</url>
<title>blabla.nl</title>
<link>http://www.blabla.com/</link>
<description>blablabla</description>
<width>110</width>
<height>82</height>
</image>
<item>
<title>Meedenken over wijkknooppunt in Daalmeer</title>
<link>http://www.blabla.com/ga/naar.aspx?ct=a&ci=95699</link>
<pubDate>Thu, 19 Apr 2007 00:00:00 GMT</pubDate>
</item>
<item>
<title>Prins Willem-Alexander opent Windfarm Egmond</title>
<link>http://www.blabla.com/ga/naar.aspx?ct=a&ci=95667</link>
<pubDate>Thu, 19 Apr 2007 00:00:00 GMT</pubDate>
</item>
<item>
<title>Vrouw buiten bewustzijn geslagen</title>
<link>http://www.blabla.com/ga/naar.aspx?ct=a&ci=95663</link>
<pubDate>Thu, 19 Apr 2007 00:00:00 GMT</pubDate>
</item>
</channel>
</rss>[/COLOR]
[COLOR=#0000ff][/COLOR]
[COLOR=black]I can seem to get the right code in my actionscript so flash only reads out the item “things” (title and link). With other words, i can’t get past the link, description, ttl etc tags. When i delete al these tags, the script works fine, but that’s no option, these tags must be in de xml doc. Can anyone give me a clue? This is my code:[/COLOR]
[COLOR=blue]function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
caption = [];
url = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
caption* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
url* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
first_item();
} else {
content = “file not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("[/COLOR][COLOR=blue]http://rk74.host.sk/blabla.xml[/COLOR][COLOR=blue]");
//
function first_item() {
delay = 3000;
p = 0;
display§;
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];
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 -= 10;
} else {
display§;
p++;
delete this.onEnterFrame;
}
};
}[/COLOR]
I am a beginner in actionscript so don’t shoot me if this question turns out to be a stupid one :bucktooth: Thanks!