1

如何动态设置补间标识符。我试过 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);

干杯

4

1 回答 1

1

我不是 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);

this这将在命名上创建两个属性TweenAXNTweenAYN其中N的值是circle.current.arrowHead.count

于 2011-06-21T20:33:08.760 回答