Flash - Play movie clip in reverse?

后端 未结 6 935
被撕碎了的回忆
被撕碎了的回忆 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:11

    You can do it passing the movie clip object to find the correct object to reverse. This manner helps you to use with the child you want. You can get it with:

    fMoveBack(this.getChildByName("my_clip"));

    function fMoveBack(my_clip:MovieClip):void {
        this.addEventListener(Event.ENTER_FRAME, playReverse(my_clip));
    }
    
    function playReverse(mc:MovieClip):Function {
        return function playReverse(e:Event):void {
            if (mc.currentFrame == 1) {
                stopPlayReverse(mc);
            } else {
                mc.prevFrame();
            }
        };
    }
    
    function stopPlayReverse(mc:MovieClip):void {
        if (this.hasEventListener(Event.ENTER_FRAME)) {
            this.removeEventListener(Event.ENTER_FRAME, playReverse);
        }
    }
    

提交回复
热议问题