我用Java写了个倒计时,但在最后想显示图片和声音该怎么做,三四天也没想出来啊,求帮助
答案:2 悬赏:10 手机版
解决时间 2021-02-12 10:17
- 提问者网友:鼻尖触碰
- 2021-02-12 00:18
我用Java写了个倒计时,但在最后想显示图片和声音该怎么做,三四天也没想出来啊,求帮助
最佳答案
- 五星知识达人网友:一袍清酒付
- 2021-02-12 01:28
package cn.flash023{
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.display.MovieClip;
public class opposeTime {
private var T:Timer;
private var p:uint;
private var total:uint;
private var __txt:TextField;
public function opposeTime(_txt:TextField ,_uint:uint ,_p:uint ):void {
__txt=_txt;
total=_uint;
p=_p;
__txt.text =timeFomat(total);
T=new Timer(1000,total);
T.addEventListener(TimerEvent.TIMER ,onTimeProgress);
T.addEventListener(TimerEvent.TIMER_COMPLETE ,onTimeComplete);
T.start();
}
private function onTimeProgress(_evt:TimerEvent):void {
__txt.text =timeFomat(--total);
}
private function onTimeComplete(_evt:TimerEvent):void {
__txt.text ="时间到!";
var _mc:MovieClip=__txt.parent as MovieClip;
trace(_mc);
_mc.gotoAndStop(p);
}
private function timeFomat(_uint:uint ):String {
var _h:String =("0"+int(_uint/3600)).substr(-2);
var _m:String =("0"+int(_uint%3600/60)).substr(-2);
var _s:String =("0"+int(_uint%3600%60)).substr(-2);
return _h + ":" + _m + ":" + _s;
}
}
}
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.display.MovieClip;
public class opposeTime {
private var T:Timer;
private var p:uint;
private var total:uint;
private var __txt:TextField;
public function opposeTime(_txt:TextField ,_uint:uint ,_p:uint ):void {
__txt=_txt;
total=_uint;
p=_p;
__txt.text =timeFomat(total);
T=new Timer(1000,total);
T.addEventListener(TimerEvent.TIMER ,onTimeProgress);
T.addEventListener(TimerEvent.TIMER_COMPLETE ,onTimeComplete);
T.start();
}
private function onTimeProgress(_evt:TimerEvent):void {
__txt.text =timeFomat(--total);
}
private function onTimeComplete(_evt:TimerEvent):void {
__txt.text ="时间到!";
var _mc:MovieClip=__txt.parent as MovieClip;
trace(_mc);
_mc.gotoAndStop(p);
}
private function timeFomat(_uint:uint ):String {
var _h:String =("0"+int(_uint/3600)).substr(-2);
var _m:String =("0"+int(_uint%3600/60)).substr(-2);
var _s:String =("0"+int(_uint%3600%60)).substr(-2);
return _h + ":" + _m + ":" + _s;
}
}
}
全部回答
- 1楼网友:醉吻情书
- 2021-02-12 02:46
waptw.com上有一款“桌面计时”软件可以实现!你登陆网站后搜一下就行!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯