EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 285

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Array.sortOn() 285
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;

Table of Contents

Related product manuals