在AS3中,我想用字符串的内容设置共享对象的键,而不是专门命名键。
so.data.test = "andy" // this is the basic working system
我不想写测试我想要这样的东西
// this is a non working and incorrect solution but shows what I am trying to do.
String myKey = "test"
so.data.{myKey} = "andy"
这是不可能的问题吗?
答案 0 :(得分:4)
未经测试,但您可以尝试:
var myKey:String = "test";
so.data[myKey] = "andy";