Hi!
I’m trying to create a simple news scroller. The scrollers is no problem, but I’m not good with XML. I am able to display a simple text in an .swf file with some AS code and an XML file. The problem is that I want to be able to display an number of sentences with the same tags. I want to have some AS code that checks if I have more of the same tags and then displays al of the scentences. I don’t want to use several dynamic textfields, I just want to use one, cause it’s easier and faster to edit the text.
This is the code I use in the .swf:
function loadXMLTB(loaded) {
if (loaded) {
_root.datum = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.body = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
content_txt.htmlText += "<u>" + datum + "</u><br><br>"
content_txt.htmlText += body +"<br><br>";
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXMLTB;
xmlData.load("nieuws.xml");
and that’s the code I use in my XML file:
<?xml version="1.0"?>
<text>
<text2>
<datum>Datum: 29/03/2008</datum>
<body>blabllkdfqlkjhdflkqdfq
</body>
<datum>Datum: 29/03/2008</datum>
<body>bla blablablablabla
</body>
</text2>
</text>
This is what I can display now in the .swf:
Datum: 29/03/2008
blabllkdfqlkjhdflkqdfq
and this is what I want to be able to display:
Datum: 29/03/2008
blabllkdfqlkjhdflkqdfq
Datum:29/03/2008
bla blablablablabla
I hope you can understand what I want to do.
thx