Here's my XML file:
<?xml version="1.0" encoding="utf-8"?>
<root>
<driverone>Mario Andretti</driverone>
<drivertwo>Luigi Andretti</drivertwo>
</root>
Super simple - all I have are two names, driverone and drivertwo.
And here's my ActionScript 3:
import flash.events.Event;
import fl.controls.Label;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
stop();
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("bulkfuel.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
{
myXML = new XML(e.target.data);
trace(myXML.driverone);
trace(myXML.drivertwo);
}
//define variable from XML data
var firstDriver:String = String(myXML.@driverone);
var coDriver:String= String(myXML.@drivertwo);
//populate text fields with variables
DriverOne_txt.text=String(firstDriver);
DriverTwo_txt.text=String(coDriver);
Everything works down to the trace function. For some reason, and I know it's stupidly simple but I just can't seem to find it, I can't get these names to load into the text fields.