AS3.0 倒计时+进度条
package com{ import flash.display.MovieClip; import flash.utils.Timer; import flash.events.TimerEvent; import flash.text.TextField; public class CutTime extends MovieClip { public static var timer:Timer; public static var countTimes:Number = 30; public static var moveMc:MovieClip; public static var startX:Number; public static var txt:TextField; public function CutTime(_moveMc:MovieClip,_txt:TextField) { txt = _txt; moveMc = _moveMc; timer = new Timer(25); timer.addEventListener(TimerEvent.TIMER,onTimer); timer.start(); startX = moveMc.x - moveMc.width; moveMc.x = startX; } public static function inint() { moveMc.x = startX; timer.start(); trace("弹框小时候执行的"); } public function onTimer(e:TimerEvent) { moveMc.x = moveMc.width * timer.currentCount / (countTimes * 40) + startX; var num:uint = countTimes - timer.currentCount / 40; txt.text = num.toString() + "S"; //trace(num,countTimes+":j进度条倒计时",timer.currentCount) if (num==countTimes) { timer.reset(); } } } }
posted on 2022-11-08 15:07 zqiang0803 阅读(72) 评论(0) 编辑 收藏 举报