|
|
简单的倒计时制作 |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
我想简单的介绍一下倒计时的控制。我想大家如果做游戏的时候会发现,倒计时对于游戏的进行是非常重要的,但是我们在flash中如何去控制它呢?这里我们只需要利用一下gettime就能够轻松办到了! 下面我们先建立一个空帧内容的mc,名称为gettime,然后我们将它放置在主场景中。接下来我们需要输入的代码只为(下面的 actions for gettime中的代码内容): actions for frame 1 stop (); fscommand ("allowscale", "0"); actions for frame 2 stop (); actions for bt on (release) { gotoAndPlay (1); } actions for gettime onClipEvent (load) { firstTime = getTimer(); } onClipEvent (enterFrame) { nowTime = getTimer(); timeValue = nowTime-firstTime; _root.time_text = 10-Math.ceil(timeValue/1000); if (timeValue>=10000) { _root.nextFrame(); } } 从gettime(MC)的代码中我们可以获息,我们在mc被载入场景时记录了一个firsttime的变量,然后利用mc的enterframe,我们将不断变化的时间与firsttime作以比较,当这个比较值等于你所需要的一个值的时候再作相应的其它操作,这样一个简单的时间倒计时就这样完成了!
|
|
相关文章:相关软件: |
|