触屏1
package com{ import flash.display.MovieClip; import flash.events.MouseEvent; import flash.utils.Timer; import flash.events.TimerEvent; public class Chuping { private var thisMc:MovieClip; private var stepNum:Number = 0; private var mcNum:Number; private var clickNum:Number; public function Chuping(_thisMc:MovieClip,_mcNum:Number,_clickNum:Number) { thisMc = _thisMc; mcNum = _mcNum; clickNum = _clickNum; thisMc.stop(); thisMc.addEventListener(MouseEvent.CLICK,onMc); MyMusic.changeSound("请问"); } private function onMc(e:MouseEvent) { var str:String = e.target.name; if (e.target.name == "btn") { MyMusic.pauseFuntion(); var newMc:MovieClip = e.target.parent as MovieClip; newMc.play(); stepNum++; trace(stepNum); if (stepNum==clickNum) { thisMc.removeEventListener(MouseEvent.CLICK,onMc); var t:Timer = new Timer(25); t.addEventListener(TimerEvent.TIMER,onT); t.start(); function onT(e:TimerEvent) { if (newMc.currentFrame == newMc.totalFrames) { t.removeEventListener(TimerEvent.TIMER,onT); for (var i:uint=1; i<=mcNum; i++) { thisMc["mc" + i].gotoAndStop(1); } stepNum = 0; thisMc.addEventListener(MouseEvent.CLICK,onMc); } } } } } } }
posted on 2019-04-28 15:08 zqiang0803 阅读(152) 评论(0) 编辑 收藏 举报