Flash - Play movie clip in reverse?

后端 未结 6 950
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 14:02

I\'m trying to get a movie clip to play in reverse when I mouse_out from it (it plays on mouse_over).

My actionscript is as follows:

mc.stop();
mc.ad         


        
6条回答
  •  借酒劲吻你
    2020-12-10 14:17

    The best way would be to use an ENTER_FRAME event listener. Basically this is what you want to do

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

    This would play your MovieClip in reverse until it hits frame 1, then it will stop.

提交回复
热议问题