Packagestencyl.api.engine.utils
Classpublic class ArrayUtil
InheritanceArrayUtil Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Class that contains static utility methods for manipulating and working with Arrays. Note that all APIs assume that they are working with well formed arrays. i.e. they will only manipulate indexed values.



Public Methods
 MethodDefined By
  
arrayContainsValue(arr:Array, value:Object):Boolean
[static] Determines whether the specified array contains the specified value.
ArrayUtil
  
arraysAreEqual(arr1:Array, arr2:Array):Boolean
[static] Compares two arrays and returns a boolean indicating whether the arrays contain the same values at the same indexes.
ArrayUtil
  
copyArray(arr:Array):Array
[static] Creates a copy of the specified array.
ArrayUtil
  
createUniqueCopy(a:Array):Array
[static] Create a new array that only contains unique instances of objects in the specified array.
ArrayUtil
  
empty(arr:Array):void
[static]
ArrayUtil
  
insert(arr:Array, index:int, value:*):void
[static]
ArrayUtil
  
removeAt(arr:Array, index:int):void
[static]
ArrayUtil
  
removeValueFromArray(arr:Array, value:Object):void
[static] Remove all instances of the specified value from the array,
ArrayUtil
Method Detail
arrayContainsValue()method
public static function arrayContainsValue(arr:Array, value:Object):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines whether the specified array contains the specified value.

Parameters

arr:Array — The array that will be checked for the specified value.
 
value:Object — The object which will be searched for within the array

Returns
Boolean — True if the array contains the value, False if it does not.
arraysAreEqual()method 
public static function arraysAreEqual(arr1:Array, arr2:Array):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Compares two arrays and returns a boolean indicating whether the arrays contain the same values at the same indexes.

Parameters

arr1:Array — The first array that will be compared to the second.
 
arr2:Array — The second array that will be compared to the first.

Returns
Boolean — True if the arrays contains the same values at the same indexes. False if they do not.
copyArray()method 
public static function copyArray(arr:Array):Array

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Creates a copy of the specified array. Note that the array returned is a new array but the items within the array are not copies of the items in the original array (but rather references to the same items)

Parameters

arr:Array — The array that will be copies

Returns
Array — A new array which contains the same items as the array passed in.
createUniqueCopy()method 
public static function createUniqueCopy(a:Array):Array

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Create a new array that only contains unique instances of objects in the specified array. Basically, this can be used to remove duplication object instances from an array

Parameters

a:Array — The array which contains the values that will be used to create the new array that contains no duplicate values.

Returns
Array — A new array which only contains unique items from the specified array.
empty()method 
public static function empty(arr:Array):void

Parameters

arr:Array

insert()method 
public static function insert(arr:Array, index:int, value:*):void

Parameters

arr:Array
 
index:int
 
value:*

removeAt()method 
public static function removeAt(arr:Array, index:int):void

Parameters

arr:Array
 
index:int

removeValueFromArray()method 
public static function removeValueFromArray(arr:Array, value:Object):void

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Remove all instances of the specified value from the array,

Parameters

arr:Array — The array from which the value will be removed
 
value:Object — The object that will be removed from the array.