# Flash AS2 and XML question

**URL:** https://forum.kirupa.com/t/flash-as2-and-xml-question/258380
**Category:** Uncategorized
**Created:** [April 23, 2008, 3:18pm UTC](https://forum.kirupa.com/t/flash-as2-and-xml-question/258380 "2008-04-23T15:18:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Reverend](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@Reverend](https://forum.kirupa.com/u/Reverend)
#### Post date: [April 23, 2008, 3:18pm UTC](https://forum.kirupa.com/t/flash-as2-and-xml-question/258380/1 "2008-04-23T15:18:33Z")

</div>

Hi experts,

I’m trying to build a Flash page using external XML. I have absolutely NO experience with XML but I’ve been fiddling with snippets all day, and I’ve come up with the following:

AS2:

[COLOR=DarkRed][INDENT]contents();  
function contents() {  
var cont:XML = new XML();  
cont.ignoreWhite = true;  
cont.onLoad = function(success) {  
if (success) {  
var root:XMLNode = this.firstChild;  
var nameText:String = root.childNodes[0].nodeValue;  
var introText:String = root.childNodes[1].nodeValue;  
theText.titleText.htmlText = nameText;  
theText.textText.htmlText = introText;  
}  
}  
cont.load(“xml/home.xml”);  
}[/INDENT][/COLOR]

XML:[INDENT][COLOR=DarkRed]\<?xml version=“1.0”?\>  
\<title\>\<![CDATA[My Title]]\>\</title\>  
\<text\>\<![CDATA[Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut gravida elit vel pede. Sed nec nibh ac lacus convallis elementum. Quisque laoreet arcu quis nibh.]]\>\</text\>[/COLOR][/INDENT]Now, the Title works fine, but the body text doesn’t – it just keeps coming up with ‘undefined’.

Can anyone spot any errors in this? please help, I’m pulling me hair out!
