得到的字符串再在AS3变量名的presentation [英] get string representation of a variable name in as3
本文介绍了得到的字符串再在AS3变量名的presentation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何方式这样做的是AS3?
any way of doing this is as3?
例如,如果我有一个 VAR狗:字符串
,我怎么能得到狗指出,变量
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
推荐答案
希望这有助于。
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
}
}
这篇关于得到的字符串再在AS3变量名的presentation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文