If you introspect the Flash 10.1 playerglobal.swc (in Flash Builder for example) you will notice a package that was not there in Flash Player 10, namely avmplus.
The interesting part is that it contains a method describeTypeJSON(*, uint):Object (which is an internal function)
The first parameter is the object to describe and the second is a flags parameter (defined as uint constants in the very same package).
HIDE_NSURI_METHODS = 1 INCLUDE_BASES = 2 INCLUDE_INTERFACES = 4 INCLUDE_VARIABLES = 8 INCLUDE_ACCESSORS = 16 INCLUDE_METHODS = 32 INCLUDE_METADATA = 64 INCLUDE_CONSTRUCTOR = 128 INCLUDE_TRAITS = 256 USE_ITRAITS = 512 HIDE_OBJECT = 1024 FLASH10_FLAGS = 1535
By doing a little monkey-patch-hacking (creating something in the same package so that it can access the internals), it is possible to expose this method for all yer class inspection purposes… *grin*
Example:
package avmplus
{
public function getInterfaces(object:*):Array
{
return describeTypeJSON(object, INCLUDE_TRAITS | INCLUDE_INTERFACES).traits.interfaces;
}
}
Update August 24th 2010: Till Schneidereit’s in-depth article on the subject.