Yeah, cool.  But for his purposes, try making a static class of that so
it's handy and it won't fly because "this" changes scope.  So not so
good when writing other classes.  A workaround?

I suppose you could use #include to bring that in, or just add that code
at the beginning of each file you work on. Neat idea though.  I'm all
for things that help me be both lazy and efficient.

Jason Merrill
Bank of America 
Learning Technology Solutions
 

>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Kenneth Kawamoto
>>Sent: Tuesday, May 30, 2006 11:14 AM
>>To: flashcoders@chattyfig.figleaf.com
>>Subject: [Flashcoders] Get Original Variable's Name in Function?
>>
>> >Is it possible to retrieve the name of the variable passed into a
>>function?
>>
>>function myFunct(str:String):Void {
>>    for (var varName in this) {
>>        if (this[varName] == str) {
>>            trace(varName+": "+str);
>>        }
>>    }
>>}
>>var foo:String = "ABC";
>>var moo:String = "DEF";
>>myFunct(foo);
>>myFunct(moo);
>>
>>// Output
>>foo: ABC
>>moo: DEF
>>
>>OK, this is not really "retrieving" the name of the variable therefore
>>cannot be trusted...
>>
>>Kenneth Kawamoto
>>http://www.materiaprima.co.uk
>>
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to