|
-
Highscores - XML
Hey everyone
I have a question. Im attempting to make a high score list for this one game using XML and ASP.
Well its going well so far, I can have an XML file, read it in Flash and things like that
But Im having a small problem of reading specific elements of the XML, this is what the file looks like:
<?xml version="1.0"?>
<highscore>
<player1>Matthew</player1>
<score1>100</score1>
</highscore>
All I want to do in Flash (for now, for the sake of learning) is to load that xml file and read the element <player1> from a trace
This is the flash I have (in a button):
on (release) {
my_xml = new XML();
myLoadxml = new XML();
my_xml.load("C:\\Inetpub\\wwwroot\\games\\highscor e.xml");
//
//
highElement = my_xml.firstChild;
playerElement = highElement.firstChild;
playerText = playerElement.firstChild;
value = playerText.nodeValue;
trace(value);
//
//
my_xml.onLoad = function(success) {
if (success) {
my_xml.contentType = "text/xml";
my_xml.xmlDecl = "<?xml version=\"1.0\" ?>";
my_xml.sendAndLoad ("http://localhost/games/test.asp", myLoadxml);
} else {
}
};
}
Basically when I click the button, the trace should display the variable 'value', which is the text of playerText, which is the child of playerElement and so on up the hierarchy list
Heres the list :
XML file
- highElement
- playerElement
- playerText
- value
Anyways, if that made ANY sense at all, I would really appreciate some help so I can get this highscores to work
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|