其他分享
首页 > 其他分享> > 触屏

触屏

作者:互联网

package com{
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.events.Event;

    public class Chuping {

        private var thisMc:MovieClip;
        private var stepNum:Number = 0;
        private var num:Number = 0;
        public function Chuping(_thisMc:MovieClip,_num:Number) {
            thisMc = _thisMc;
            num = _num;
            if (thisMc.hasEventListener(MouseEvent.CLICK) == false) {
                thisMc.addEventListener(MouseEvent.CLICK,onThis);
            }
        }
        private function onThis(e:MouseEvent) {
            var str:String = e.target.name;
            if (str.slice(0,3) == "btn") {
                stepNum++;
                MyMusic.pauseFuntion();
                if (stepNum==num) {
                    var t:Timer = new Timer(25);
                    t.addEventListener(TimerEvent.TIMER,onT);
                    t.start();
                    function onT(e:TimerEvent) {
                        if (thisMc["mc2"].totalFrames == thisMc["mc1"].currentFrame) {
                            t.removeEventListener(TimerEvent.TIMER,onT);
                            MyMusic.changeSound("驱蚊器翁2")
                            MyMusic.soundChannel.addEventListener(Event.SOUND_COMPLETE,onComplete)
                            function onComplete(e:Event){
                                for(var i:uint=1;i<=num;i++){
                                    thisMc["mc"+i].gotoAndStop(1)
                                    num=0
                                    stepNum=0
                                }
                            }
                        }
                    }
                }
            }
        }

    }

}

 

标签:flash,private,num,var,import,thisMc,触屏
来源: https://www.cnblogs.com/zqiang0803/p/10751034.html