Reflection in AS3

1. Use flash.utils.describeType function to get properties of an object

import flash.utils.describeType;
var description:XML = describeType(v3dView)
//will output an xml object

2. Use the old-good-day “for-property-in-object” loop to get properties/values of an object

3. Use is/as/instanceof operands to determine whether an object is compatible to or a member of the data type:

//output true
trace("is pp type of AccountProxy? "+(pp is AccountProxy));

//output [object AccountProxy]
trace("is pp as AccountProxy? "+(pp as AccountProxy));

//output true
trace("is pp instance of AccountProxy? "+(pp instanceof AccountProxy));


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: