Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML in Flash

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
Here is my xml (news.xml)
<?xml version=&quot;1.0&quot;?>
<news>
<newsitem>
<headline>head line 0</headline>
<newstext>this is the text for newsitem
0</newstext>
</newsitem>
<newsitem>
<headline>head line 1</headline>
<newstext>this is the text for newsitem
1</newstext>
</newsitem>
</news>

Here is my AS:
function myOnLoad() {
//trace(myXML);
trace(myXML.firstChild.firstChild.firstChild.nodeValue);
}

if (myXML.loaded) {
if (myXML.status==0) {
myXML.ignoreWhite;
myXML.onLoad=myOnLoad();

_root.stop();
} else {
myBox.text=&quot;notloaded&quot;;
_root.gotoAndPlay(2);
}
} else {
gotoAndPlay(2);
}

I know the xml is getting loaded as trace(myXML) works fine, but
trace(myXML.firstChild.firstChild.firstChild.nodeValue);
produces undefined when my thinking is that it should produce head
line 0

what am I doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top