I’m trying to create a dynamic news section that works off of a XML file and I’m running into some problems. Here’s the code I’m using right now
//load XML
xmlContent = new XML();
xmlContent.ignoreWhite = true;
xmlContent.load("news.xml");
xmlContent.onLoad = function(success){
if(success){
processXML(xmlContent);
}
}
function processXML(xmlContent) {
numEntries = xmlContent.firstChild.firstChild.childNodes.length;
for (i = 0; i <= numEntries; i++) {
clipName = "news" + i;
module.news.duplicateMovieClip(clipName, i);
module[clipName].headline_txt.htmlText = xmlContent.firstChild.firstChild.childNodes*.firstChild.nodeValue;
module[clipName].body_txt.htmlText = xmlContent.firstChild.firstChild.nextSibling.childNodes*.firstChild.nodeValue;
module[clipName]._y = i * 163;
}
}
It seems to duplicate the movies correctly, but it won’t load the XML into the corresponding text boxes I’ve created. I’ve included a link to the source files as well if anyone has a minute to take a look.
http://client.methodsofmadness.com/dropbox/XMLnews.zip
Also, if you can help with getting the date from the attributes of the news item I’d like it to go in the “date_txt” box within the news module clip.
Any help would be appreciated!