佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1615|回复: 1

谁会用flash来制作“倒数计时”。。。(紧急)

[复制链接]
发表于 16-4-2007 01:13 AM | 显示全部楼层 |阅读模式
谁会用flash来制作“倒数计时”。。。
时间是两分钟。。。

本人现在在做着flash game。现在遇到问题了。。。
想请教这里高人会不会。。。

请帮忙,谢谢哦。。。
回复

使用道具 举报


ADVERTISEMENT

发表于 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 很有兴趣。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 6-9-2025 03:17 AM , Processed in 0.125731 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表