Reflection refers to how a program obtains class information during runtime, such as dynamically creating class instances and methods.
See http://bbs.9ria.com/thread-133293-1-1.html
To sum up the usage of as3 reflection, there are four functions:
Flash. system. ApplicationDomain. getDefinition (linkName: String): Class; // The Link name of a component in the flashcs component library.
Flash. utils. getDefinitionByName (name: String): Object; // return Class Object Reference of the class specified by the name parameter
For example, sp: Sprite = new Sprite ();
Flash. display: Sprite: Package path
Flash. utils. getQualifiedClassName (value: *): String; // The fully qualified class name of the returned object.
Flash. utils. getQualifiedSuperClassNameTest; // returns the fully qualified class name of the base class of the object specified by the value parameter.
GetDefinitionByName
The usage is as follows::
Obtain the reference of the flash. text. TextField class. The as statement has no exception in type conversion. If the conversion fails, the target variable will be set to null.
Var ClassReference: Class = getDefinitionByName ("com. display. textField ") as Class; var instance: TextField = new ClassReference () as TextField; instance. autoSize = "left"; instance. text = "I use getDefinitionByName to dynamically create ";