示例:
public var myVar:Object;
// now I want to get the myVar string
// myVar is not instanced*
public var whatINeedIsThisVar:String = 'myVar';
感谢
答案 0 :(得分:0)
没有办法做到这一点,并且当你在发布模式下工作时(即没有去除swf),本地变量名不再存在。
但如果它是某个类的公共字段名称,则可以使用describeType来创建名称。
package {
import flash.utils.describeType;
class Foo extends Sprite {
public var bar:Object;
function Foo(){
super();
// trace all public field name in this class
for each (variable:XML in describeType(this).variable) {
trace("field name : ", variable.@name);
}
}
}
}