gpt4 book ai didi

actionscript-3 - Flash - 反向播放影片剪辑?

转载 作者:行者123 更新时间:2023-12-04 03:54:33 25 4
gpt4 key购买 nike

我试图让影片剪辑在我 mouse_out 时反向播放(它在 mouse_over 上播放)。

我的 Action 如下:

mc.stop();
mc.addEventListener(MouseEvent.MOUSE_OVER,mover);
mc.addEventListener(MouseEvent.MOUSE_OUT,mout);

function mover(e:MouseEvent):void
{
mc.play();
}

function mout(e:MouseEvent):void
{
//Play in reverse
}

我将如何实现这一目标?

谢谢

最佳答案

最好的方法是使用 ENTER_FRAME 事件监听器。基本上这就是你想要做的

function mover(e:MouseEvent):void {
stopPlayReverse();
mc.play();
}

function mout(e:MouseEvent):void {
this.addEventListener(Event.ENTER_FRAME, playReverse, false, 0, true);
}

function playReverse(e:Event):void {
if (mc.currentFrame == 1) {
stopPlayReverse();
} else {
mc.prevFrame();
}
}

function stopPlayReverse():void {
if (this.hasEventListener(Event.ENTER_FRAME)) {
this.removeEventListener(Event.ENTER_FRAME, playReverse);
}
}

这将反向播放您的 MovieClip,直到它到达第 1 帧,然后它将停止。

关于actionscript-3 - Flash - 反向播放影片剪辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2049788/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com