Packagemx.utils
Classpublic class ArrayUtil
InheritanceArrayUtil Inheritance Object

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

The ArrayUtil utility class is an all-static class with methods for working with arrays within Flex. You do not create instances of ArrayUtil; instead you call static methods such as the ArrayUtil.toArray() method.



Public Methods
 MethodDefined By
  
arraysMatch(a:Array, b:Array, strictEqualityCheck:Boolean = true):Boolean
[static] Checks if the Array instances contain the same values against the same indexes, even if in different orders.
ArrayUtil
  
arrayValuesMatch(a:Array, b:Array, strictEqualityCheck:Boolean = true):Boolean
[static] Checks if the Array instances contain the same values, even if in different orders.
ArrayUtil
  
getArrayValues(value:Array):Array
[static] Used to obtain the values in an Array, whether indexed or associative.
ArrayUtil
  
getItemIndex(item:Object, source:Array):int
[static] Returns the index of the item in the Array.
ArrayUtil
  
toArray(obj:Object):Array
[static] Ensures that an Object can be used as an Array.
ArrayUtil
Method Detail
arraysMatch()method
public static function arraysMatch(a:Array, b:Array, strictEqualityCheck:Boolean = true):Boolean

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Checks if the Array instances contain the same values against the same indexes, even if in different orders.

Parameters

a:Array — The first Array instance.
 
b:Array — The second Array instance.
 
strictEqualityCheck:Boolean (default = true) — true if we should compare the values of the two Arrays using the strict equality operator (===) or not (==).

Returns
Boolean — true if the two Arrays contain the same values (determined using the strict equality operator) associated with the same indexes.
arrayValuesMatch()method 
public static function arrayValuesMatch(a:Array, b:Array, strictEqualityCheck:Boolean = true):Boolean

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Checks if the Array instances contain the same values, even if in different orders.

Parameters

a:Array — The first Array instance.
 
b:Array — The second Array instance.
 
strictEqualityCheck:Boolean (default = true) — true if we should compare the values of the two Arrays using the strict equality operator (===) or not (==).

Returns
Boolean — true if the two Arrays contain the same values.
getArrayValues()method 
public static function getArrayValues(value:Array):Array

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Used to obtain the values in an Array, whether indexed or associative.

Parameters

value:Array — The Array instance.

Returns
Array — an indexed Array with the values found in value.
getItemIndex()method 
public static function getItemIndex(item:Object, source:Array):int

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Returns the index of the item in the Array.

Parameters

item:Object — The item to find in the Array.
 
source:Array — The Array to search for the item.

Returns
int — The index of the item, and -1 if the item is not in the list.
toArray()method 
public static function toArray(obj:Object):Array

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Ensures that an Object can be used as an Array.

If the Object is already an Array, it returns the object. If the object is not an Array, it returns an Array in which the only element is the Object. If the Object implements IList it returns the IList's array. As a special case, if the Object is null, it returns an empty Array.

Parameters

obj:Object — Object that you want to ensure is an array.

Returns
Array — An Array. If the original Object is already an Array, the original Array is returned. If the original Object is an IList then it's array is returned. Otherwise, a new Array whose only element is the Object is returned or an empty Array if the Object was null.