产品:液晶电视冰箱洗衣机抽油烟机热水器燃气灶微波炉除湿器面包机电风扇手机豆浆机

as 3.0 怎么建立计时器 定时器,求指教

常见问题

var h:String = "0";var m:String = "0";var s:String = "0";var b:uint = 100;var hous:TextField=new TextField();hous.autoSize = TextFieldAutoSize.LEFT;//当然这里还不是万能的格式脚本,因为你要求100秒,所以在此简化了!hous.text="00:"+"0"+Math.floor(b/60)+":"+(b%60);hous.border = true;hous.borderColor = 0x996600;hous.x = 100,hous.y = 75;addChild(hous);var timer:Timer = new Timer(1000);timer.start();timer.addEventListener(TimerEvent.TIMER,onTime);function onTime(evt:TimerEvent):void{b--;h = "00";m=String(Math.floor(b/60));s=String(b%60);if (b/60<10){m="0"+Math.floor(b/60);}if (b%60<10){s = "0" + (b % 60);}hous.text = h + ":" + m + ":" + s;if (b<=0){hous.text = "计时结束";evt.target.removeEventListener(TimerEvent.TIMER,onTime);timer = null;//如果想清除出文本,可以加上以下代码:removeChild(DisplayObject(hous));hous = null;}}

标签:3计步器   OMRON计步器   欧姆龙计步器   计步器欧姆龙   

相关问题

热门问题

0