MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 285

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

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
Performing a case-insensitive, descending sort on the password field produces the following
results:
my_array.sortOn("password", 1|2)
// catchy
// Bob
// barb
// abcd
Performing a default sort on the age field produces the following results:
my_array.sortOn("age")
// 29
// 3
// 35
// 4
Performing a numeric sort on the age field produces the following results:
my_array.sortOn("age", 16)
// 3
// 4
// 29
// 35
Performing a descending numeric sort on the age field produces the following results:
my_array.sortOn("age", 18)
// 35
// 29
// 4
// 3
Performing a sort changes the elements in the array as follows:
// Before sorting
// my_array[0].age = 29;
// my_array[1].age = 3;
// my_array[2].age = 35;
// my_array[3].age = 4;
// After any sort that doesn't pass a value of 8 for option
my_array.sortOn("age", Array.NUMERIC);
// my_array[0].age = 3;
// my_array[1].age = 4;
// my_array[2].age = 29;
// my_array[3].age = 35;
Array.sortOn()
285

Advertisement

Table of Contents
loading

Table of Contents