Length of Object map actionscript
I have an object using as a map in actionscript
var map:Object = new Object();
map[1] = "one";
map[2] = 开发者_Go百科"one";
Is there any easy way to get length of map without iterating?
It may not be better, but I think it's easier to use ObjectUtil...
import mx.utils.ObjectUtil;
ObjectUtil.getClassInfo(map).properties.length;
That would return 2 in your case.
No, the easiest way is iterating the map.
精彩评论