|
-
High Scores Table
Hi All,
I need to build a high scores table for a maths game I have built. It should keep track of the highest 8 scores and sort them into the correct order of highest in first place...
If I use the xml connector is there a way to sort the order in actionscript?? If not then I'll have to pass the name, score and school out as a querystring and use ASP to build a text file.
Any ideas anyone???
Cheers for any advice...
-
Senior Member
You can collect the data in an array and use sortOn.
myArray = new Array(4,6,2);
myArray.sortOn(Array.NUMERIC);
trace(myArray);
- The right of the People to create Flash movies shall not be infringed. -
-
Do you mean from an xml file?
Hi
Can I set up the same xml connector to both read and write?
(I presume I can as I'm trying at the mo and my book says I can) However its not working so I guess that it will be easier if I have one to read in the previous High Scores and one to write out the user details when a new high score is reached???
I was reading about sortOn too. Can I create an array straight from my xml file once it is in flash??
Cheers for the help
M
-
Senior Member
Yes, you just add the childNodes to the array and once all nodes are added you sort the array. Here is one possibility.
myArray.push(myXML.childNodes[count]);
count++;
if (count >= myXML.childNodes.length)
{
myArray.sortOn etc, etc
}
- The right of the People to create Flash movies shall not be infringed. -
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
|