1
votes

Does anyone know some ActionScript api to get String of a variable name like following:

var foo:int;
var variableName:String = getName(foo);
trace(variableName);

The console need to show "foo" as the result of trace(variableName);

1
Thank you Patrick. Yes, now I find out it's duplicate question. Sorry. - Light Yagmi

1 Answers

2
votes

What are you trying to achieve with this?

flash.utils.describeType can help find the name/types of any variables of an object but I don't think it will give you the instance name. I believe most of that information is lost when you compile the code so getting it at runtime will be rather difficult.