Just got through with the “Displaying XML in Flash” tutorial and it was very easy. I took the XML document on the tutorial and created more childNodes within the parent node. The problem is that I cannot get the actionscript to display text in the text window beyond the first child node.
I noticed in the tutorial http://www.kirupa.com/developer/actionscript/xmldataflash.htm that it tells how to get other data from the first child node but not the second.
Please help. I’m stuck. I’ve included a copy of the XML and a copy of the actionscipt.
XML:
<?xml version=“1.0”?>
<flashcopy>
<intro>
<headline>Do You Love Football, Basketball and Baseball?</headline>
<body>Your search is over – ajcsportsplus delivers all the local sports news you want in one convenient package. Falcons, Dawgs, Tech. No one else does local college and professional football like the AJC.</body>
</intro>
<tech>
<headlinetech>Can Tech Do It Again? Join Their Road To The Final Four!</headlinetech>
<bodytech>Oft-criticized quarterback Reggie Ball will start against Syracuse, but how much he'll play probably depends on how well he plays.</bodytech>
</tech>
<uga>
<headline>Bowl Practice Turns Competitive As Dogs Shake Off Rust</headline>
<body>Though UGA policy will not allow David Pollack's number to be retired, he could be fast-tracked into the school's Circle of Honor.</body>
</uga>
<falcons>
<headline>Falcons Fever Going Around As Team's Fortunes rise</headline>
<body>Allen Rossum and Warrick Dunn are revved up after Saturday's win over Carolina, as are Falcons fans throughout the city.</body>
</falcons>
<braves>
<headlinebraves>Could Betemit Bring Outfielder?</headlinebraves>
<bodybraves>These are your experts. The only place to get them online is at ajcsportsPlus. Talk back to our sports columnists--agree or disagree. You can't have this much fun anywhere else!</bodybraves>
</braves>
</flashcopy>
Actionscript:
function loadXML(loaded) {
if (loaded) {
_root.tech = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
_root.body = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
headline.text = _root.tech;
body.text = _root.body;
} else {
content = “file not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“promotext.xml”);
Thanks.
Dan