I bet you are trying to find a nifty way to log your code's processing,
right?  This comes up a lot and really, there is no good way to do it.

 

You might try the archives, in case I missed something, but if I'd ever
heard a good solution I would have used it myself.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of frank_sommers
Sent: Thursday, September 25, 2008 12:39 AM
To: [email protected]
Subject: [flexcoders] Obtaining name of method

 

Hi, 

I'm looking for a way to obtain the name of method, given a Function
object. 

For instance, inside a method, I can obtain a reference to the method by
calling 
arguments.callee. But how do I then obtain from the Function object the
function's name:

public function testFunction():void {
var f:Function = arguments.callee;
// How do I get f's name (e.g., "testFunction") here?
}

I was thinking of iterating through the object's properties, and finding
if a given property 
is the function itself, but this only works for methods dynamically
added to the object:

public function testFunction():void {
var f:Function = arguments.callee;
for (var p:String in this) {
if (f == this[p]) {
// Function name is p
}
}
}

Again, this doesn't work. 

Any suggestions would be appreciated. 

Thanks, 

-- Frank

 

Reply via email to