The sortOn() method only exists in the Array class. It is not supported in the Vector class of ActionScript 3.0.

The sortOn() method works with arrays whose elements are objects. These objects must have at least one common property than can be used as the sort key. NOTE the use of the curly brackets {}:

var poets:Array = new Array();

poets.push({name:”Angelou”, born:”1928″});

poets.push({name:”Blake”, born:”1757″});

poets.push({name:”cummings”, born:”1894″});

poets.push({name:”Dante”, born:”1265″});

poets.push({name:”Wang”, born:”701″});

//This is how it works:

poets.sortOn(“born”, Array.NUMERIC);

for (var i:int = 0; i < poets.length; ++i)


trace(poets[i].name, poets[i].born);


See Adobe official documents for more info.