1, array does not require all element uniform type, does not support typed array
var i:int=23;
var array:array=[122,i, "Asdfasdf", "ASDFASDFASDF"];
2. Initialize and access array elements
Slightly
3, the length of the array
The length of the array is not fixed, and the length of the array can vary with the Members ' additions and deletions.
★ In fact, the length of the array is read by the Getter method, and the length of the setting is setter method, if the length of the set is less than the existing array, you then the index is greater than [original array length-1] elements are discarded. If you set the length of an array to be greater than the existing lengths, the elements from the last element of the original array to the middle of the end of the new array are automatically set to undefined.
The implementation is as follows:
Public function Get Length (): uint{} public
function set Length (value:uint): uint{}
You can use an index that exceeds the length to set the element:
var array:array=["Asss", "Asdfasdf", "ASDFASDFASDF"];
Array[5]= "DD";
Trace (array);//ASSS,ASDFASDF,ASDFASDFASDF,,, DD
4. Find IndexOf, LastIndexOf
Camel type function name
Destination array. indexOf (the element to find)
Destination array. lastIndexOf (the element to find)
The target array. indexOf (the element to find, the starting position of the lookup)
The target array. lastIndexOf (the element to find, the starting position of the lookup)
Returns the index if found, otherwise returns-1;
5. Add and remove elements at the end of the array
The push method, which adds one or more elements to the end of the array, returning the new array length
Unshift method, adding one or more elements to the array header, returning the new array length
Pop method, deleting an element at the end of the array, returning the deleted element
Shift method, deleting an element at the header of an array, returning the deleted element