【问题标题】:Stop an animation in a child-movieclip from a parent once parent animation complete父动画完成后,从父动画停止子影片剪辑中的动画
【发布时间】:2013-02-13 10:38:18
【问题描述】:

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

我尝试从 move 函数内部访问腿:

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

【问题讨论】:

    标签: flash actionscript actionscript-2 flash-cs5 tween


    【解决方案1】:

    我不太清楚你电影的结构,但我怀疑你只是在 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 的文章可能会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多