String 如何使用字符串表示变量
我有一个对象String 如何使用字符串表示变量,string,actionscript-3,variables,String,Actionscript 3,Variables,我有一个对象e,它的属性如下e.property1,e.property2,e.property3… 现在我想使用for循环来跟踪所有属性。我该怎么做 这就是我要找的东西- for(var i:int =0; i<10; i++) { trace(e.property+i); //how do I get the property no. i } for(变量i:int=0;i 痕迹 property1 :: test property2 :: 23.3 property3 ::
e
,它的属性如下e.property1,e.property2,e.property3…
现在我想使用for循环来跟踪所有属性。我该怎么做
这就是我要找的东西-
for(var i:int =0; i<10; i++)
{
trace(e.property+i); //how do I get the property no. i
}
for(变量i:int=0;i
痕迹
property1 :: test
property2 :: 23.3
property3 :: 29
在这里使用虚构的值感谢您的回答,但您是否可以完全按照我的示例编写它。这将帮助我理解。只需通过包含“属性”的s
过滤结果即可。
for (var i:* in e) trace(i+" :: "+e[i]);
// if they have to be strings just use ...+e[i].toString();
property1 :: test
property2 :: 23.3
property3 :: 29