Flash - 停止循环播放动画

时间:2012-05-09 10:48:14

标签: flash animation actionscript actionscript-2 banner

我有一个Flash横幅,我需要一些元素来翻转他们的父级,然后停止,然后在推出时运行不同的动画。只要用户表现自己,这种方法就可以正常工作,但是如果你摇动鼠标以便快速连续进行多次翻转/翻转,它会将动画抛入无限循环。还有其他人遇到过这个问题吗?

我的动作脚本是:

on (rollOver) {
    //frames 2 - 10 are the "turn on" animation
    this.gotoAndPlay(2);
    //frames 11 - 25 are house_three's "turn on" animation
    _root.house_three.gotoAndPlay(11);
}
on (rollOut) {
    //frames 11 - end are the "turn off" animation
    this.gotoAndPlay(11);
    //frames 26 - end are house_three's "turn off" animation
    _root.house_three.gotoAndPlay(26);
}

house_three(在这种情况下)在第10帧,第25帧和最后一帧上有stop();个,当前对象在第1帧,第10帧和最后一帧上有stop();个,所以它不应该在任何情况下都不会超过这些。

我认为它可能与排队的动画的许多实例有关,但这会使动画运行多次然后停止(对吗?),但它似乎无限运行。

1 个答案:

答案 0 :(得分:0)

尝试在rollOver和rollOut中设置测试,以查看横幅当前是否正在播放。如果是,请停止,然后播放。

if(this.isPlaying)
{
    this.stop();
    this.gotoAndPlay(2)
}