0

我有一个羊的电影剪辑符号(符号名称:“羊”)。这会在屏幕上显示动画。在绵羊影片剪辑中,它的腿上下移动。当绵羊停止移动时,我希望腿也停止动画。

我试图从移动功能内部访问腿:

function sheepMove6() {
    var sheepMoveX6:Tween = new Tween (inst_sheep, "_x", Strong.easeOut, 900, 850, 10, false);

    sheepMoveX6.onMotionFinished = function() {
        sheep.leg1MoveY.stop();
    }
}

我还尝试从绵羊电影剪辑中检测动画完成:

_root.sheepMoveX6.onMotionFinished = function() {
    leg1MoveY.stop();
}

一旦羊到达目的地,这些似乎都不能阻止腿移动。我正在使用 AS2。

- 编辑 -

不知道如何定位子影片剪辑,我尝试了几种不同的方法来访问它,在下面,没有一个有效。注意:leg1MoveY 是补间变量的名称

_root.inst_sheep.inst_leg1.leg1MoveY.stop();
_root.inst_sheep.inst_leg1.stop();
_root.inst_sheep.stop();
_root.inst_sheep.inst_leg1.stop();
_root.inst_leg1.stop();
this.inst_sheep.inst_leg1.leg1MoveY.stop();
this.inst_sheep.inst_leg1.stop();
this.inst_sheep.stop();
this.inst_sheep.inst_leg1.stop();
this.inst_leg1.stop();
4

1 回答 1

0

我不能完全说出你电影的结构,但我怀疑你只是leg1MoveYinst_leg1. 如果是这样,leg1MoveY只能从该函数内部访问(其“范围”仅限于该函数)。在函数之外声明它(我猜 leg1 做了什么):

var leg1MoveY:Tween;

function legMove() {
    leg1MoveY = new Tween(... // Tween settings
}

然后您尝试的第一行应该可以工作:

inst_sheep.inst_leg1.leg1MoveY.stop();

这里有一篇关于ActionScript 2中作用域的文章可能会有所帮助。

于 2013-02-13T13:57:23.473 回答