查看: 1615|回复: 1
|
谁会用flash来制作“倒数计时”。。。(紧急)
[复制链接]
|
|
谁会用flash来制作“倒数计时”。。。
时间是两分钟。。。
本人现在在做着flash game。现在遇到问题了。。。
想请教这里高人会不会。。。
请帮忙,谢谢哦。。。 |
|
|
|
|
|
|
|
发表于 16-4-2007 04:33 PM
|
显示全部楼层
在第一个 frame 画一个dynamic text:
instance name = timerOut
Var = timeleft
然后在第一个 frame 加 actionscript,如下:
stop();
totalTime = 120;
//Start from 2 minute
startTime = getTimer();
function timer() {
timeLeft = (totalTime*1000)-(getTimer()-startTime);
minutes = Math.floor(0);
seconds = Math.floor(timeLeft/1000);
milliseconds = Math.floor((timeLeft-(seconds*1000))/10);
millisOut = milliseconds;
secondsOut = seconds;
minsOut = minutes;
if (seconds>59) {
secondsOut = seconds-60;
minsOut = minutes+1;
}
if (minsOut<10) {
minsOut = String("0"+minsOut);
}
if (millisOut<10) {
millisOut = String("0"+millisOut);
}
if (secondsOut<10) {
secondsOut = String("0"+secondsOut);
}
_level0.timerOut.text = minsOut+" : "+secondsOut+" : "+millisOut;
if (seconds<0) {
_level0.timerOut.text = ("Time's Up" ;
_root.gotoAndStop(11);
clearInterval(timer1);
}
}
timer1 = setInterval(timer, 10);
以上的 _root.gotoAndStop(11) 可以自己改咯。我做的例子如下:
http://www.geocities.com/cshaopin/countdowntimer.swf
http://www.geocities.com/cshaopin/countdowntimer.fla
你的 game 做好了可否分享一下? 呵呵 ~ 因为我也对做 game 很有兴趣。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|