Get all properties of an object

Hi all,

Is there a way to get the array list of all property name and value of a object?

I was looking for something like [properties] array list, sample:

var b:Button = new Button();
b.label = “click me”;

for(var p=0; p<b.properties.length; b++) {
trace("name: " + b.properties[p].name + ", value: "+b.properties[p].value);
}

—sample result—
name: enabled, value: true
name: label, value: click me
name: visible, value: true
…//and the rest

Thanks in advance.