var time_base:int; var micro_seconds:int=0; var bStart:Boolean=true; var secondRemained:int=0; var totalSecond:int=10; var myTimer:Timer = new Timer(100); myTimer.addEventListener(TimerEvent.TIMER, myTimerFunc); stop(); //timerStart(); function myTimerFunc(event:TimerEvent) { micro_seconds = getTimer() - time_base; //trace(micro_seconds); secondRemained = totalSecond- Math.floor(micro_seconds / 1000); if(secondRemained>=0) { this.timer_txt.text=secondRemained.toString(); } else { this.alarm_mc.play(); } } function timerStart() { time_base = getTimer(); myTimer.start(); } start_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler); function fl_MouseClickHandler(event:MouseEvent):void { timerStart(); } pause_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2); function fl_MouseClickHandler_2(event:MouseEvent):void { totalSecond=secondRemained; myTimer.stop(); this.alarm_mc.stop(); }