???

That won't work, cus a) it still won't display correct names for local
scope variables and b) what if you have two vars with the same value???

Lee



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kenneth
Kawamoto
Sent: 30 May 2006 16:14
To: [email protected]
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

_______________________________________________
[email protected]
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
_______________________________________________
[email protected]
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