I'm a bit of a newbie to getting data from XML into Flash, but I'm seeing that
this is going to be very important to future projects that I work on. I am
using FileMaker Pro (currently version 7, but upgrading to 8) to create a
database and exporting XML file from there to read into Flash. I cannot seem to
get the data from the XML to show up in the Flash movie. I have been following
a tutorial on Lynda.com on Flash/FileMaker integration, but the XML file
doesn't look quite the same. Here is the XML data I get when exporting from
FileMaker:
<FMPXMLRESULT xmlns="
http://www.filemaker.com/fmpxmlresult"> <ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="05-06-2004" NAME="FileMaker Pro" VERSION="7.0v2"/>
<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="RecRev"
NAME="Penn.State.On.The.Air.fp7" RECORDS="1" TIMEFORMAT="h:mm:ss a"/>
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="PersonNam" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ProgramNam" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="PersonBio" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ProgramDesc" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="AudioName" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="VideoNam" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Notes" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="LastUpdate" TYPE="DATE"/>
</METADATA>
<RESULTSET FOUND="1">
<ROW MODID="1" RECORDID="1">
<COL><DATA>Fran Fisher</DATA></COL>
<COL><DATA>TV Quarterbacks (1965-1985)</DATA></COL>
<COL><DATA>One of the classic voices of Penn State Athletics, Fran Fisher has
called football and basketball on the radio, as well as hosted several Penn
State-related programs on both television and radio. Beginning in 1966, Fisher
hit the airwaves providing color commentary on football radiocasts. A year
later, he joined the crew of WPSX-TV???s TV Quarterbacks, to narrate game films
and was made a co-host in 1968???a post he retained until the show???s end in
1984. After three years of doing football color work on the radio, he was
shifted to play-by-play duties. In this role he became the voice of Penn State
Football and provided a steady presence in the booth through the 1982 National
Championship season.
</DATA></COL>
<COL>
<DATA>The first television program to focus on Penn State Football, TV
Quarterbacks was the brainchild of WPSX-TV general manager Marlowe Froke.
Debuting in 1965, and initially titled Wednesday Quarterbacks, the show was
hosted by Harris Lipez and Ken Holderman and included commentary from Coach Rip
Engle.
</DATA>
</COL>
<COL>
<DATA>
</DATA>
</COL>
<COL>
<DATA>
</DATA>
</COL>
<COL>
<DATA>
</DATA>
</COL>
<COL>
<DATA>3/23/2007</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
I've tried many iterations of the combination of firstChild and sibling, but I
either get NULL, UNDEFINED, or a blank text area where the PersonNam and
PersonBio data should go. Here is the Actionscript I'm using to load the data:
myXML = new XML();
xmlFile = "fmp.xml"
myXML.load(xmlFile);
function myOnLoad () {
PersonNam =
myXML.firstChild.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.firs
tChild.firstChild.firstChild.nodeValue;
PersonBio =
myXML.firstChild.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.firs
tChild.firstChild.nextSibling.firstChild.firstChild.nodeValue;
}
myXML.onLoad = myOnLoad;
I think I just don't understand XML well enough to get the right data path. It
confuses me that the data in the XML file looks different than what I saw on
the tutorial.