Er, we've worked that out already ;)

Lee



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian
Thomas
Sent: 30 May 2006 16:49
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Get Original Variable's Name in Function?

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
_______________________________________________
[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