AS2:动态补间标识符

时间:2011-06-21 13:20:33

标签: animation actionscript actionscript-2 tween

如何动态设置补间标识符。我试过eval,但它说我需要在赋值运算符的左边有一个变量。这是我试过的:

eval ("TweenAX" + circle.current.arrowHead.count) = new Tween(circle.current.arrowHead, "_x", mx.transitions.easing.Strong.easeOut, circle.current._x, Stage.width/2, 2, true);
eval ("TweenAY" + circle.current.arrowHead.count) = new Tween(circle.current.arrowHead, "_y", mx.transitions.easing.Strong.easeOut, circle.current._y, Stage.height/2, 2, true);

干杯

1 个答案:

答案 0 :(得分:0)

我并非100%确定我理解您要实现的目标,但我认为您正在寻找括号语法:

this["TweenAX" + circle.current.arrowHead.count] = new Tween(circle.current.arrowHead, "_x", mx.transitions.easing.Strong.easeOut, circle.current._x, Stage.width/2, 2, true);
this["TweenAY" + circle.current.arrowHead.count] = new Tween(circle.current.arrowHead, "_y", mx.transitions.easing.Strong.easeOut, circle.current._y, Stage.height/2, 2, true);

这将在名为thisTweenAXN的{​​{1}}上创建两个属性,其中TweenAYNN的值