/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Returns the length of an associative array or object similar function to Array.length * * @param $obj * @return int * */ public static function __getAssociativeArraySize($obj:Object):int { var length:int = 0; /* the length counter to be returned */ if ($obj != {} || $obj != null) { /* check if the object is null or has no elements and return zero as the length */ for (var s:String in $obj) { /* iterate on each element of the object and increase the counter */ length++; } } return length; /* return the length*/ }
Comments
