Using a Flash XML Object as a String

Thought I better blog this as I wasted a good hour trying to do what I thought was so simple.

Please note I am only showing part of the code.

I was trying to pass the value of the following pageURL var to any function or even a simple output of trace(pageURL) but it just spat out undefined 🙁

[sourcecode language=”php”]
xmlNode = this.firstChild;
var pageURL = xmlNode.childNodes[36].childNodes[i].firstChild;
trace(pageURL);
[/sourcecode]

I finally found out that you have to add toString() at the end for it to work. 🙂

[sourcecode language=”php”]
xmlNode = this.firstChild;
var pageURL = xmlNode.childNodes[36].childNodes[i].firstChild.toString();
trace(pageURL);
[/sourcecode]

Something I will always remember in the future when working with XML nodes.