AnsweredAssumed Answered

import FMP XML file into Flash using Actionscript 3.0?

Question asked by pbesong on Feb 16, 2010


import FMP XML file into Flash using Actionscript 3.0?


I was hoping to find someone who works with Flash on this forum as the Adobe forum can't seem to help me.


I'm having a hard time reading in the XML data I exported from FileMaker Pro (v. 8.5) into Flash. Does anyone have the AS3 code to use for this? I am exporting the XML as FMPXMLRESULT and the AS3 code I have just doesn't seem to want to talk to it. I want to loop thru and create arrays of each <DATA> object for each record. Here is the AS3 code I am using:


var simXML:XML = new XML();

simXML.ignoreWhitespace = true;

var xmlLoader:URLLoader = new URLLoader();




xmlLoader.load(new URLRequest("sim.xml"));


 function init(evt:Event):void {

    simXML = XML(;

    try {

for (var i:int=0; i<=simXML.firstChild.childNodes[4].childNodes.length-1; i++) {


backgroundArray.push(xDoc.firstChild.childNodes[4].childNodes[i].childNodes[0].c hildNodes[0].childNodes[0]);

         descriptionArray.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[1 ].childNodes[0].childNodes[0]);

choice1Array.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[2].ch ildNodes[0].childNodes[0]);

choice2Array.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[3].ch ildNodes[0].childNodes[0]);

choice3Array.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[4].ch ildNodes[0].childNodes[0]);

                choice4Array.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[5].c hildNodes[0].childNodes[0]);

                questionArray.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[18] .childNodes[0].childNodes[0]);

                titleArray.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[19].ch ildNodes[0].childNodes[0]);

                videoArray.push(simXML.firstChild.childNodes[4].childNodes[i].childNodes[20].ch ildNodes[0].childNodes[0]);





          } catch (err:Error) {

     trace("Could not parse loaded content as XML:\n" + err.message);




function onIOError(evt:IOErrorEvent):void {

trace("An error occurred when attempting to load the XML file.\n"+ evt.text);




All I ever get is the "Could not parse" message. The problem appears to be in the code that pushes the XML data into the arrays. If I create an XMLDocument object instead of an XML object, the data loads, but any quotes come in as &quot; so I think I need to use the XML object. I tried setting the text field to htmltext, but that didn't help.