加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 07:33:49 所属栏目:百科 来源:网络整理
导读:当我从它的mouse_out(它在mouse_over上播放)时,我试图获得一个影片剪辑来反向播放. 我的动作如下: mc.stop();mc.addEventListener(MouseEvent.MOUSE_OVER,mover);mc.addEventListener(MouseEvent.MOUSE_OUT,mout);function mover(e:MouseEvent):void{ mc.pl
当我从它的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,然后它将停止.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读