Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating Dictionary length in Flex

What's the best way to calculate the length of a Dictionary object in Flex?

var d:Dictionary = new Dictionary();
d["a"] = "alpha";
d["b"] = "beta";

I want to check the length which should be 2 for this Dictionary. Is there any way to do it other than looping through the objects?

like image 477
calvinf Avatar asked Apr 01 '09 21:04

calvinf


Video Answer


1 Answers

No, there is no way to check the length of an object(Dictionary is pretty much an object that supports non-String keys) other than looping through the elements.

http://www.flexer.info/2008/07/31/how-to-find-an-objects-length/

You probably don't have to worry about checking if the property is an internal one.

like image 132
CookieOfFortune Avatar answered Sep 30 '22 13:09

CookieOfFortune