get string representation of a variable name in as3
问题 any way of doing this is as3? for example, if I have a var dog:String , how can I get "dog" out of that variable? Looking into reflection to do this, but there's got to be an easier way -- A 回答1: Hope this helps. class A { var dog:String = "something"; var cat:String = "eatdog"; } function getVars(obj:*):void { for(var i:* in obj){ trace( i + " : " + obj[i]); // this will trace all properties of object. // dog : somthing // cat : eatdog } } 回答2: First of all if it's an instance of a custom