I’ve got an external xml file loaded into a text field… I’m trying to format the text within the xml file with actionscript. Specifically, I’d like to make the dates a different color from the actual posts, and I want to add a blank line between each post. Here’s the xml file:
<?xml version="1.0" encoding="utf-8"?>
<news>
<post>
<date>01.07.11</date>
<content>A lot has changed for the band. For one, we are no longer Tracey Bones. Now we are called Sinister Kid. Also, the band's added a new member to its ranks -- me, Andres, on vocals, which leaves Tyler able to concetrate completely on guitar. And I brought this website with me. It's not much in terms of content, but I figured I'd get a little creative with the animation, so enjoy.</content>
</post>
<post>
<date>01.07.11</date>
<content>post number 2</content>
</post>
<post>
<date>01.07.11</date>
<content>post number 3</content>
</post>
</news>
…and here’s the actionscript I’m using:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("news.xml"));
function LoadXML(e:Event):void
{
var xml:XML = XML(xmlLoader.data);
var newsChildren:XMLList = xml.post.children();
for each (var newsInfo:XML in newsChildren)
{
newsTxt.text = newsTxt.text+"
"+newsInfo;
}
}
Any help would be greatly appreciated…