}
// Results:
// john, omaha
// john, kansas city
// bob, omaha
rec_array.sortOn(["name", "city"]);
for(i=0; i<rec_array.length; i++){
trace(rec_array[i].name + ", " + rec_array[i].city);
}
// Results:
// bob, omaha
// john, kansas city
// john, omaha
rec_array.sortOn(["city", "name" ]);
for(i=0; i<rec_array.length; i++){
trace(rec_array[i].name + ", " + rec_array[i].city);
}
// Results:
// john, kansas city
// bob, omaha
// john, omaha
The following array of objects is used by the remaining examples, which show how to use the
parameter:
options
var my_array:Array = new Array();
my_array.push({password: "Bob", age:29});
my_array.push({password: "abcd", age:3});
my_array.push({password: "barb", age:35});
my_array.push({password: "catchy", age:4});
Performing a default sort on the password field produces the following results:
my_array.sortOn("password");
// Bob
// abcd
// barb
// catchy
Performing a case-insensitive sort on the password field produces the following results:
my_array.sortOn("password", Array.CASEINSENSITIVE);
// abcd
// barb
// Bob
// catchy
Array
261
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?