sort int vaules in array

i want to sort the players health points on the gameover screen to work out who came 1st, 2nd, 3rd and 4th. Then display them in gui.

this is what i have already please help:

static var P1 : int;

static var P2 : int;

static var P3 : int;

static var P4 : int;

var result = new Array ();

function Sort () : Array {

}

arrays can be sorted with array.sort() in javascript. (which is what I’m guessing you are using)

so

var result = [p1, p2, p3, p4]

result.sort();