Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML load coming back empty?

Status
Not open for further replies.

Wolfie7873

Technical User
Jan 15, 2004
94
US
I'm using AS3.

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>
I want to load this using AS3:
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top