# Problem with displaying XML content, in AS2

**URL:** https://forum.kirupa.com/t/problem-with-displaying-xml-content-in-as2/295002
**Category:** flash
**Created:** [August 24, 2009, 9:00am UTC](https://forum.kirupa.com/t/problem-with-displaying-xml-content-in-as2/295002 "2009-08-24T09:00:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![smgDesign](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@smgDesign](https://forum.kirupa.com/u/smgDesign)
#### Post date: [August 24, 2009, 9:00am UTC](https://forum.kirupa.com/t/problem-with-displaying-xml-content-in-as2/295002/1 "2009-08-24T09:00:23Z")

</div>

Hello everyone!

I want to make a horizontal news scroller in flash.  
I’m trying to load information from an XML file, namely the news title and an URL.  
So, I will eventually have 10 text boxes, each with it’s own content and URL. I will then move the boxes right to left, but before that’s gonna happen, I’m having issues displaying the XML content.

Here is my code:

( **t2.xml** is the xml file from which I load, **news** is the news title and \*\*url \*\*is, obviously the link I want to use; **nt** is my text box)

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
news = [];  
url = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
news\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
url\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
}  
} else {  
content = “nothing loaded”;  
}  
}

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“t2.xml”);

nt.text = news[0];

nt.onRelease = function()  
{  
getURL(url[0], “\_self”);  
}

The result of this is nt displaying “undefined” and the link not working - I know I went wrong somewhere but don’t know where, as my AS skill aren’t quite good…

Please help me out and thanks in advance 🙂
