将字符串组合成实例名称:Actionscript 2 / Flash

时间:2015-12-08 11:42:07

标签: flash actionscript-2

我想组合字符串以在下面的脚本中使用它。

    var x = 2;
    "Shoot"+x._x += 50;

这项工作:Shoot2._x+= 50;但我有两个以上的射击

如何组合它们,我可以在我的" Shoot2"上使用._x。动画片段的实例

1 个答案:

答案 0 :(得分:1)

您可以使用以下方式执行此操作:

this['Shoot' + x]._x += 50;

eval('Shoot' + x)._x += 50;

setProperty()设置值:

setProperty(eval('Shoot' + x), _x, 50); 

有关详细信息,请查看here

希望可以提供帮助。