Ok… I’ve been stumped over this for a little while, and just can’t get it. I have done the Using XML in Flash CS3/AS3 tutorial, and have been unsuccessful at achieving all nodes of my xml to display in a textfield. My trace shows everything correctly, however, on the stage I only get one line. This is the code…
import flash.display.;
import flash.text.;
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("…/xml/news.xml"));
var myTF:TextField = new TextField();
myTF.multiline = true;
myTF.autoSize = “left”;
myTF.border = true;
myTF.textColor = 0xFFFFFF;
myTF.wordWrap = true;
addChild(myTF);
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseNews(xmlData);
}
function ParseNews(NewsInput:XML):void {
var newsChildren:XMLList = NewsInput.Article.children();
for each (var newsInfo:XML in newsChildren) {
myTF.text = newsInfo;
trace(newsInfo);
}
}
And this is the XML…
<?xml version=“1.0” encoding=“utf-8”?>
<News>
<Article>
<Headline>News Article 1</Headline>
<Date>XX.XX.XX</Date>
<Content>Whatever you want</Content>
</Article>
<Article>
<Headline>News Article 2</Headline>
<Date>XX.XX.XX</Date>
<Content>Whatever you want</Content>
</Article>
</News>
If you guys have got any ideas… I just can not figure out what I am doing wrong. I’m trying, but I just can’t get it. Thanks.