03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

my_array[3].age = 35<br />

Performing a descending numeric sort on the age field produces the following results:<br />

my_array.sortOn("age", Array.DESCENDING | Array.NUMERIC);<br />

// my_array[0].age = 35<br />

// my_array[1].age = 29<br />

// my_array[2].age = 4<br />

// my_array[3].age = 3<br />

When using the Array.RETURNEDINDEXARRAY sorting option, you must assign the return<br />

value to a different array. The original array is not modified.<br />

var indexArray:Array = my_array.sortOn("age", Array.RETURNINDEXEDARRAY);<br />

See also<br />

| bitwise OR operator, sort (Array.sort method)<br />

splice (Array.splice method)<br />

public splice(startIndex:Number, [deleteCount:Number], [value:Object]) :<br />

Array<br />

Adds elements to <strong>and</strong> removes elements from an array. This method modifies the array<br />

without making a copy.<br />

Parameters<br />

startIndex:Number - An integer that specifies the index of the element in the array where<br />

the insertion or deletion begins. You can specify a negative integer to specify a position relative<br />

to the end of the array (for example, -1 is the last element of the array).<br />

deleteCount:Number [optional] - An integer that specifies the number of elements to be<br />

deleted. This number includes the element specified in the startIndex parameter. If no value<br />

is specified for the deleteCount parameter, the method deletes all of the values from the<br />

startIndex element to the last element in the array. If the value is 0, no elements are deleted.<br />

value:Object [optional] - Specifies the values to insert into the array at the insertion point<br />

specified in the startIndex parameter.<br />

Returns<br />

Array - An array containing the elements that were removed from the original array.<br />

Example<br />

The following example creates an array <strong>and</strong> splices it by using element index 1 for the<br />

startIndex parameter. This removes all elements from the array starting with the second<br />

element, leaving only the element at index 0 in the original array:<br />

248 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!