# Displaying XML through Flash

**URL:** <https://forum.kirupa.com/t/displaying-xml-through-flash/314800>\
**Category:** flash\
**Created:** [October 9, 2010, 1:50am UTC](https://forum.kirupa.com/t/displaying-xml-through-flash/314800 "2010-10-09T01:50:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ludacris](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@ludacris](https://forum.kirupa.com/u/ludacris)\
**Post date:** [October 9, 2010, 1:50am UTC](https://forum.kirupa.com/t/displaying-xml-through-flash/314800/1 "2010-10-09T01:50:19Z")

</div>

Hey guys I’m really struggling with this. I’m trying to display my XML data through two dynamic text boxes that I have on my stage but keeps showing up with “undefined”. The FLA and XML files are located in the same folder. I followed the tutorial on here and customised it to match my node names and text box instance names but and left the code the same but nothing

Actionscript Code:

function loadXMLData(loaded) {  
if (loaded) {  
\_root.news = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
\_root.comment = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;  
news\_txt.text = \_root.news;  
comment\_txt.text = \_root.comment;  
}  
else {  
trace(“Could not load XML file”);  
}  
}  
xmlFile = new XML();  
xmlFile.ignoreWhite = true;  
xmlFile.onLoad = loadXMLData;  
xmlFile.load(“news.xml”);

XML Code:

\<?xml version=“1.0”?\>

\<news\>

```
&lt;info&gt;
    
    &lt;latest&gt;What's the latest?&lt;/latest&gt;
    
    &lt;comment&gt;You can find us at the markets.&lt;/comment&gt;

&lt;/info&gt;

```

\</news\>

Would really like to know what I’m doing wrong so any help would be appreciated. Thanks.
