2013-02-13 86 views
0

我有一只绵羊的movieclip符号(符号名称:“绵羊”)。这在整个屏幕上呈现出动画效果。在羊电影剪辑里面,有一些双腿在上下移动。当羊停止移动时,我想腿也停止动画。一旦父动画完成,停止从父级到子级动画片的动画

我试图从移动的函数内部访问腿:

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(); 

回答

0

我不能完全告诉你电影的结构的名称,但我怀疑你只是在inst_leg1声明leg1MoveY一个函数内。如果是这样,leg1MoveY只能从内部访问(其“范围”仅限于该功能)。声明它之外的功能(我猜什么LEG1一样):

var leg1MoveY:Tween; 

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

然后你尝试的第一个行应当工作:

inst_sheep.inst_leg1.leg1MoveY.stop(); 

这里有一篇关于scope in ActionScript 2可能的帮助。

+0

谢谢,文章非常有用 – Fisu 2013-02-14 09:03:14