Just adding to what Alex said: parameters' names don't exist in compiled
SWF, they are referenced by indices (when the function starts, the
parameters are pushed to the stack and just follow the stack logic). So, no,
reflection can only tell you the number of parameters used (you can get it
from myFunction.length property), but the names simply don't exist.

Regarding the function name, if it's a public / protected / internal /
custom namespace method, you can get it through describeType() if you call
it on the object, where the function belongs to, and then compare it like
so:

var s:Sprite = new Sprite();
var list:XMLList = describeType(s).meth...@name;
var f:Function = s.addChild;
list.(s[valueOf().toString()] == f && trace("method found",
valueOf().toString())); //method found addChild

However, anonymous functions do not have names (the names of anonymous
functions are generated dynamically following a pattern), also, it's not
 always possible to get the name of functions which are declared as
variables.

Another way of retrieving this info is by parsing the assembly (the DoABC
tag), even the release builds contain the function method, but this is a bit
complex, and, I don't think that it would be worth the effort,
unless retrieving the function's name is the purpose of your application.

Best.

Oleg

Reply via email to