given the following
function A(b:Function) { }
If function A(), can we determine the name of the function being passed in as parameter 'b' ? Does the answer differ for AS2 and AS3 ?
given the following
function A(b:Function) { }
If function A(), can we determine the name of the function being passed in as parameter 'b' ? Does the answer differ for AS2 and AS3 ?
I've been trying out the suggested solutions, but I ran into trouble with all of them at certain points. Mostly because of the limitations to either fixed or dynamic members. I've done some work and combined both approaches. Mind you, it works only for publicly visible members - in all other cases null is returned.
I don't know if it helps, but can get a reference to the caller of the function which arguments (as far as I know just in ActionScript 3).
Heres a simple implementation
And in a file called FunctionUtils I put this...
I use the following:
Usage:
Output: FlexAppName/on_applicationComplete()
More information about the technique can be found at Alex's site:
http://blogs.adobe.com/aharui/2007/10/debugging_tricks.html
Are you merely looking for a reference so that you may call the function again after? If so, try setting the function to a variable as a reference. var lastFunction:Function;
Now if you need to reference the last function ran, you can do so merely through calling lastFunction.
I am not sure exactly what you are trying to do, but perhaps this can help.
The name? No, you can't. What you can do however is test the reference. Something like this: