热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

flex4.6倒计时组件

[CDATA[import flash.events.Event;import flash.events.TimerEvent;import flash.media.Sound;import fla


xmlns:s&#61;"library://ns.adobe.com/flex/spark"xmlns:mx&#61;"library://ns.adobe.com/flex/mx"width&#61;"486" height&#61;"82" creationComplete&#61;"init()" fontWeight&#61;"bold">[CDATA[import flash.events.Event;import flash.events.TimerEvent;import flash.media.Sound;import flash.media.SoundChannel;import flash.utils.Timer;import mx.controls.Alert;import mx.events.CloseEvent;import mx.events.ColorPickerEvent;private var timer:Timer;public var h_num:int&#61;0;public var m_num:int&#61;0;public var s_num:int&#61;10;public var sumit:Function;private function init():void{this.timeComplete();timer &#61; new Timer(1000, 0);timer.addEventListener(TimerEvent.TIMER, onTimer);timer.start();}private function onTimer(event:TimerEvent):void{s_num &#61; s_num - 1;if ((s_num &#61;&#61; -1) && (m_num > 0)) {m_num &#61; m_num - 1;s_num &#61; 59;}if ((m_num &#61;&#61; 0) && (h_num > 0)){h_num &#61; h_num -1;m_num &#61; 59;s_num &#61; 59;}if(s_num<30 && h_num&#61;&#61;0 && m_num&#61;&#61;0){tip.text&#61;"距离考试结束还有"&#43;s_num&#43;"秒&#xff0c;请您尽快提交当前题的答案哦&#xff01;";}if (s_num <0){s_num &#61; 0;timer.stop();Alert.yesLabel &#61; "确定";Alert.show("考试结束时间到&#xff01;", "提示", Alert.YES, this, function(event:CloseEvent):void{var flag:int &#61; event.detail;if(flag &#61;&#61; Alert.YES){
Alert.show("YES");
//sumit.call();}});}var hh:String;var mm:String;var ss:String;hh &#61; (h_num <10) ? "0" &#43; h_num.toString() : h_num.toString();mm &#61; (m_num <10) ? "0" &#43; m_num.toString() : m_num.toString();ss &#61; (s_num <10) ? "0" &#43; s_num.toString() : s_num.toString();time2_txt.text &#61; time_txt.text &#61; hh &#43; "小时" &#43; mm &#43; "分" &#43; ss&#43;"秒"; }private function timeComplete():void{var hh:String;var mm:String;var ss:String;hh &#61; (h_num <10) ? "0" &#43; h_num.toString() : h_num.toString();mm &#61; (m_num <10) ? "0" &#43; m_num.toString() : m_num.toString();ss &#61; (s_num <10) ? "0" &#43; s_num.toString() : s_num.toString();time2_txt.text &#61; time_txt.text &#61; hh &#43; ":" &#43; mm &#43; ":" &#43; ss; }]]>
fontWeight&#61;"bold"/>fontWeight&#61;"bold" text&#61;"距离考试结束还有&#xff1a;"/>


转:https://www.cnblogs.com/hekin/archive/2012/07/18/2597011.html



推荐阅读
author-avatar
彦贞法禎3222
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有