Using XML and ActionScript with Flex Applications - Reflection (Page 4 of 5 )
ActionScript 3.0 supports class reflection using the following functions in the flash.utils package:
flash.utils package:ActionScript 3.0 supports class reflection using the following functions in the flash.utils package:
getQualifiedClassName
getQualifiedSuperclassName
getDefinitionByName
describeType
We’ll next discuss each of these functions in more detail.
Getting the Class Name
You can retrieve the name of the class for which an object is an instance using the getQualifiedClassName() function. The function requires that you pass it a reference to an object; it then returns the fully qualified class name:
var loader:URLLoader = new URLLoader(); var className:String = getQualifiedClassName(loader); trace(className); // Displays flash.net.URLLoader
If you want to retrieve the fully qualified superclass name for an object, you can use thegetQualifiedSuperclassName()function:
var loader:URLLoader = new URLLoader(); var className:String = getQualifiedSuperclassName(loader); trace(className); // Displays flash.events.EventDispatcher