触屏
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 } } } } } } } } }
posted on 2019-04-22 16:43 zqiang0803 阅读(87) 评论(0) 编辑 收藏 举报