Hi there, here is my second XML problem for the day.
here is the actionscript:
function populateNews(news_xml){
var items = news_xml.firstChild.firstChild.childNodes
for(var i=0; i<items.length; i++){
if(items*.attributes.head == "Storyheadline"){
var headline = items*.firstChild;
var item_mc = attachMovie("headline_mc","headline_mc"+z, this.getNextHighestDepth());
item_mc._x = 137.9;
item_mc._y = 281.1;
item_mc.heading1.text = headline.nodeValue;
trace(headline);
}
}
}
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
if(success) populateNews(this)
else trace("Error loading file");
}
my_xml.load("news.xml");
and here is the XML:
<?xml version="1.0"?>
<news>
<newsarticles>
<article head = "Storyheadline">
<articlehead>This is the first story</articlehead>
<article1>
<![CDATA[Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore
magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exercitation ulliam corper suscipit lobortis nisl ut aliquip
ex ea commodo consequat. Duis autem veleum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel willum
lunombro dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril
delenit augue duis dolore te feugait nulla facilisi.]]>
</article1>
</article>
</newsarticles>
</news>
Problem is my text box in the item_mc instance gives me a null. When I trace the headline variable I get <articlehead>This is the first story</articlehead>, which is correct, but I cant seem to parse the nodevalue from the XML?