Wolfie7873
Technical User
I'm using AS3.
For testing purposes, I have a very simple XML document:
I want to load this using AS3:
When I compile and test, I get the "Data Loaded." Message, but nothing from the XML file is there. The second trace statement does nothing, and I can't access any of the data. Ideas?
For testing purposes, I have a very simple XML document:
Code:
<decorations>
<smallgift>
<id>smallgift1</id>
<visible>true</visible>
<dedication>
"For our beloved Sheepie, Oberon, from Titania and Puck."
</dedication>
</smallgift>
<smallgift>
<id>smallgift2</id>
<visible>false</visible>
<dedication>
""
</dedication>
</smallgift>
</decorations>
Code:
var decorations:XML = new XML();
var XML_URL:String = "tree.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void
{
decorations = XML(myLoader.data);
trace("Data loaded.");
}
trace(decorations.toXMLString());
When I compile and test, I get the "Data Loaded." Message, but nothing from the XML file is there. The second trace statement does nothing, and I can't access any of the data. Ideas?