360Flex SJ 2008 - Reflective Programming by Eric Ko
DIGG IT!
1
Comments
Published
Tuesday, September 09, 2008
at
8:41 AM
.
Similar to the Java Reflection API, ActionScript Reflection can do the following:
* Determine the class/type of an object;
* Provide the constants and function declarations of an interface;
* Provide the information of the fields, functions, constructors, superclasses, and modifiers of a class;
* Generate an instance of a class of which the handle is unknown before runtime;
* During runtime, get and set the value of a field of an object/class;
* During runtime, invoke a function of an object
This is not only a session to introduce Reflection in Flex, but also will provide the technical details how to implement it.
Cheers,
ted :)
I'm a big fan of introspection / reflection... but unfortunate for us 'Flexies' DescribeType is very slow making purely reflected implementations impractical at best; the more it is used the slower your application will perform. It is a powerful feature - one that should be used with constraint and common sense. As an alternative - a simple manifest could be used to minimize the performance hit.