Hey everyone,
I’m having a problem loading a local xml file into my swf. My ultimate goal is to parse the xml file into a list of guests attending a party. Here is the code I have:
var loader:URLLoader;
function loadXML():void
{
loader = new URLLoader(new URLRequest("test1.xml"));
loader.addEventListener(Event.COMPLETE, doGuests);
}
function doGuests(e:Event)
{
var xml:XML = new XML(e.target.data);
trace("XML:");
trace(xml); //shows xml file
var list:XMLList = xml.guests.guest;
trace("LIST:");
trace(list); //shows nothing
}
loadXML();
As you can see, the first trace statement outputs the xml file with the tags and all. The second trace statement outputs nothing. I did try uploading the xml file to a server, and then using http://www.catharsiswd.com/test1.xml as the URL for the URLRequest, but that didn’t work either. Any insight would be greatly appreciated!