The problem here is, if the variable is not constructed as the property
of an object, then the name is not kept. For example:
class MyClass
{
public var pvar:String = "fine";
public function MyClass()
{
var lvar:String = "not fine";
tracethis(lvar);
tracethis(pvar);
}
}
While pvar will have its name somewhere in the instanced objects, the
lvar will not. This is because flash will drop the naming as its scope
is at the function level and so is not important.
Lee
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Doug
Coning
Sent: 30 May 2006 14:15
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Get Original Variable's Name in Function?
Nothing heinously wrong. See other post for how I'd like to be able to
trace the original name of the variable for tracking purposes...
Thanks,
Doug Coning
Senior Web Development Programmer
FORUM Solutions, LLC
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of John Mark Hawley
> Sent: Tuesday, May 30, 2006 9:10 AM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] Get Original Variable's Name in Function?
>
> Why would you need to know the variable name? It sounds like something
> has gone heinously wrong with your code if this need is popping up.
>
> Doug Coning wrote:
> > Greetings all,
> >
> > Is it possible to retrieve the name of the variable passed into a
> > function? For instance:
> >
> > function myFunct(str:String){
> > // GET ORIGINAL NAME of str?
> > }
> >
> > var foo:String = "ABC";
> > var moo:String = "DEF";
> > myFunct(foo);
> > myFunct(moo);
> >
> > In the above, how can myFunct know that the first call was sent
'foo'
> > and the second call was sent 'moo'?
> >
> > Thanks,
> >
> > Doug Coning
> > Senior Web Development Programmer
> > FORUM Solutions, LLC
> >
> > This e-mail and any attachment(s) are intended for the specified
> recipient(s) only and are legally protected. If you have received
this
> communication in error, please "reply to" sender's e-mail address with
> notification of the error and then destroy this message in all
electronic
> and physical forms.
> > _______________________________________________
> > [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
This e-mail and any attachment(s) are intended for the specified
recipient(s) only and are legally protected. If you have received this
communication in error, please "reply to" sender's e-mail address with
notification of the error and then destroy this message in all
electronic and physical forms.
_______________________________________________
[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