I have used techniques in Actionscript 2 (with eval) to be able to execute a function (or a method on a class) based only on knowing it’s name in string-text form (and its path, of course).
In AS2, this was fairly easy like: eval(“this.”+someMethodName+"()")
However, AS3 no longer has that same kind of functionality.
However, it does have some other functions which are intriguing as possibilities, but I haven’t yet worked out how to do it.
I’ve got this to get a static class reference to an object’s class:
var objClass:Class = getDefinitionByName(getQualifiedClassName(obj)) as Class;
Then, using that I can say:
objClass.StaticMethod();
But, what if i had the string “StaticMethod” and I wanted to call that method on the objcLASS?
Moreover, if I have a non-static method (also defined by its string text name), on a particular instance (obj), and I want to call it, it should be the same process, right?
I’ve looked at describeType(), and it returns the XML object with an appropriate reference to a particular method, and I’m sure I could construct an E4X query to narrow down to that item, but I don’t really think that will help, as I’ve already got the string text name of the method.