PDA

View Full Version : Get data from xml to variable


Archmage Zen
03-11-2009, 03:38 PM
Ok, I'm writing a RPG in flex 3 and will be using a XML file to store player data. I need to put the data from the xml file to a variable.

Thanks,

Zen



XML File
<?xml version="1.0" encoding="ISO-8859-1"?>
<Demo>
<Name>Demoman</Name>
<Level>1</Level>
<Lives>3</Lives>
<Standimage>flowRoot8241867.png</Standimage>
<Walkimage>flowRoot6812.swf</Walkimage>
<Attackimage>flowroot95.swf<Attackimage>
</Demo>

Sekhar
03-11-2009, 04:41 PM
Not sure what your question is. If you want to know how to load your XML, it depends on when you want to load. Loading at compile time is really easy: just use say Model with the URL as the source. To load at run time, use HTTPService with the resultFormat you want (I like e4x because you can use all the fancy e4x access inside the XML). Don't forget to call send() to actually make the request.

Archmage Zen
03-11-2009, 04:50 PM
Sorry that I wasn't making sense.
What i'm trying to do is get data from a XML file and put it a variable that so I can data bind it to an image