To check if an object is empty or not

Ashine picture Ashine · Oct 26, 2009 · Viewed 16.3k times · Source

I want to check in my function if a passed argument of type object is empty or not. Sometimes it is empty but still not null thus I can not rely on null condition. Is there some property like 'length'/'size' for flex objects which I can use here. Please help. Thanks in advance.

Answer

Simon Buchan picture Simon Buchan · Oct 26, 2009

If you mean if an Object has no properties:

var isEmpty:Boolean = true;
for (var n in obj) { isEmpty = false; break; }