Actionscript 3 introspection -- function names

Posted by Markus O'reilly on Stack Overflow See other posts from Stack Overflow or by Markus O'reilly
Published on 2009-07-30T18:24:55Z Indexed on 2010/04/04 6:53 UTC
Read the original article Hit count: 412

I am trying to iterate through each of the members of an object. For each member, I check to see if it is a function or not. If it is a function, I want to get the name of it and perform some logic based on the name of the function. I don't know if this is even possible though. Is it? Any tips?

example:

var mems: Object = getMemberNames(obj, true);

for each(mem: Object in members) {
    if(!(mem is Function))
        continue;

    var func: Function = Function(mem);

    //I want something like this:
    if(func.getName().startsWith("xxxx")) {
        func.call(...);
    }

}

I'm having a hard time finding much on doing this. Thanks for the help.

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about introspection