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

前端之家收集整理的这篇文章主要介绍了actionscript-3 – Flash – 反向播放影片剪辑?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我从它的mouse_out(它在mouse_over上播放)时,我试图获得一个影片剪辑来反向播放.

我的动作如下:

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,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,然后它将停止.

猜你在找的Flash相关文章