If you need to find the length of an object, and I mean the number of children of the specified object, use the following function/method:
public static function getLength(o:Object):uint
{
var len:uint = 0;
for (var item:* in o)
if (item != "mx_internal_uid")
len++;
return len;
}
In Flex there is no method to get the length of an object and if you look at an object or an associative array in debugging mode you’ll that length property is not present or is 0 for associative arrays.
I know that there are different ways of arranging data in indexed array structures to have the length property but sometimes maybe you want to know if the object has at least a child or how many children it has.
There is another issue… some arrays/objects used mostly as data providers do get an internal property called mx_internal_uid, so you may not want to count that as a child:
if (item != "mx_internal_uid")
More about mx_internal_uid here (livedocs) and in a future article.
转载自 : http://www.flexer.info/2008/07/31/how-to-find-an-objects-length/
分享到:
相关推荐
var AssociativeArray = require ( 'associative-array' ) ; var arr = new AssociativeArray ( ) ; arr . push ( 'key' , { value : 'value' } ) ; arr . push ( 'key2' , { value : 'value2' } ) ; arr . push ( '...
PHP Arrays Single, Multi-dimensional, Associative and Object Arrays in PHP 7 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如...
年前在重写淘宝旺铺里的会员卡脚本的时候,无意...if(associative_array.length > 0) { // to do}会发现 associative_array.length 始终等于 0,当时有点迷惑,后来才知道这就像大家认为 IE 中支持 CSS 属性 display:i
一个 ASP 类,可以像在 PHP 中一样创建简单的关联数组; 您可以以编程方式管理任何结构化数据; 该类还提供了从 MySQL 或 MSAccess 数据库加载数据或将关联数组导出到 XML 的方法。
实现关联数组的Delphi类。 键可以是字符串或整数。 密钥存储在红黑树中。 数组可以包含TObjects或它的后代。
PHP Arrays Single Multi-dimensional Associative and Object Arrays in PHP 7 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn...
单元对象关联记忆 探索想法 每个单元格都可以像杰森一样 它们是类似Lua表的关联记忆。 json是关联内存或表的实际字符串表示形式。 但是,出于讨论目的,Json仅被视为与关联存储器或lua表相同,后者可以转换为字符串...
Apress.PHP.Arrays.Single.Multi-dimensional.Associative.and.Object.Arrays.in.PHP.7.1484225554.rar 最新书籍,精讲PHP数组,文字版PDF
multi-label lazy associative classifier, which progressively exploits dependencies among labels. Further, since in our lazy strategy the classification model is in- duced on an instance-based fashion,...
CAJUN* is a C++ API for ... name/value pairs, associative array, etc.); it humbly leaves text markup to XML. It is ideal for storing persistent application data, such as configuration or user data files.
联想记忆神经网络(Associative Memory),用于分类
C++ associative containers
Gain an in-depth understanding of PHP 7 arrays. After a quick overview of PHP 7, each chapter concentrates on single, multi-dimensional, associative, and object arrays. ...
Associative hierarchical CRFs for object class image segmentation2009.pdf Automatic segmentation for semantic objects from multiview images2008.pdf Automatic Segmentation of Background Defocused ...
基于神经元网络和 Linear Auto-Associative memory 和pca的人脸识别程序。
Work with collections, varrays, tables, and associative array collections Locate and repair errors and employ exception handlers Execute black box, white box, and integration tests Configure and ...
描述了强化学习在游戏中获胜的关键性技巧的论文。对于提高强化学习算法的稳定性,有效性和高效具有决定性的帮助。
MATLAB IMPLEMENTATION OF BIDIRECTIONAL ASSOCIATIVE MEMORY
不同的语言中,它被理解为对象(object),纪录(record),结构(struct),字典(dictionary),哈希表(hash table),有键列表(keyed list),或者关联数组 (associative array)。 * 值的有序列表(An ...
Example of using AWK's Associative Arrays Output of the script Picture Perfect PRINTF Output PRINTF - formatting output Escape Sequences Format Specifiers Width - specifying minimum field size ...