Off the top of my head, written in textmate and gmail, not Builder, YMMV, etc:
public class UtilClass { private static nameCache : Dictionary = new Dictionaty(true); public static function getNameOf(f : Function, inInstace : Object) : String { if (f in nameCache) return nameCache[f]; for each(var name : String in (DescribeTypeCache.describeType(this).typeInfo)[EMAIL PROTECTED]) { if (inInstance[name] == f) { nameCache[f] = name; return name; } } return "anonymous()"; } } SomeClass { function someMethod(...) : SomeReturnValue { //Identify myself! log.debug("Called function {0}, with args {1}",UtilClass.getNameOf(arguments.callee, this), arguments); //... } } -Josh On Sat, Oct 4, 2008 at 5:02 PM, Ralf Bokelberg <[EMAIL PROTECTED]>wrote: > I've done it in Cairngorm before. My business delegate extends the > flash.utils.Proxy class and forwards all the calls to the backend. To > make this work, you have to make the delegate dynamic though. This > means you loose some type safety. > > Ralf > > > On Sat, Oct 4, 2008 at 12:42 AM, frank_sommers <[EMAIL PROTECTED]> > wrote: > > Thanks. I wonder how the describeType() function does its work... that > seems > > to have > > access to some reflective information about a class. > > > > Actually, I have a system that uses BlazeDS for remote calls. What I'd > like > > to do is to be > > able to automatically proxy server-side classes: given a method name on > the > > local proxy, > > I want to be able automatically dispatch a remote method with the same > name > > and same > > arguments to the server. The calls are made asynchronously and dispatch > > events when > > they return. Right now I have to refer to the current method name with a > > String. That's > > duplicate information, and also doesn't enforce that the local and remote > > method names > > are the same. I'd hate to use code generation for this, so if a > > Function.name property > > existed, that'd do the trick. > > > > Thanks, > > > > -- Frank > > > > --- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > >> > >> 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > >> Behalf Of frank_sommers > >> Sent: Thursday, September 25, 2008 12:39 AM > >> To: flexcoders@yahoogroups.com > >> 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 > >> > > > > > > ------------------------------------ > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Alternative FAQ location: > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > Links > > > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." http://flex.joshmcdonald.info/ :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]