That won't work - for example:

var foo:String = "ABC";
var moo:String = "ABC";
myFunct(foo);
myFunct(moo);

// Output
foo: ABC
foo: ABC

On 5/30/06, Kenneth Kawamoto <[EMAIL PROTECTED]> wrote:
 >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