0

在 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" 

这是一个不可能的问题吗?

4

1 回答 1

4

未经测试,但您可以尝试:

var myKey:String = "test";
so.data[myKey] = "andy";
于 2011-07-18T08:28:47.833 回答