;

PDA

Click to See Complete Forum and Search --> : High Scores Table


yombi69
03-06-2007, 04:39 AM
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... :)

cancerinform
03-06-2007, 09:36 AM
You can collect the data in an array and use sortOn.

myArray = new Array(4,6,2);
myArray.sortOn(Array.NUMERIC);
trace(myArray);

yombi69
03-06-2007, 10:55 AM
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 :yikes:

cancerinform
03-06-2007, 12:05 PM
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
}