我已經瀏覽了所有網頁,並且每個人都可以教您如何爲您的遊戲或倒數計時器製作計時器,但我似乎無法找到如何添加時間到已經在計時了。添加時間到定時器/計數器
因此,這裏是我的櫃檯類:
package
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.text.TextField;
import flash.events.Event;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class Score extends MovieClip
{
public var second:Number = 0;
public var timer:Timer = new Timer(100);
private var stageRef:Stage;
public function Score(stageRef:Stage)
{
x = 560.95;
y = 31.35;
this.stageRef = stageRef;
timer.addEventListener(TimerEvent.TIMER, scoreTimer);
timer.start();
}
public function scoreTimer(evt:TimerEvent):void
{
second += 1;
scoreDisplay.text = String("Score: " +second);
}
這工作沒有任何問題或問題,只是保持在100ms的速度向上計數,我想知道的是如何加說30數秒如果東西發生在我的比賽中,比如說你殺死一個敵人。
請幫忙!
找出如何使用任何Flash對象的好方法是檢查它的語言參考http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Timer.html 。在這種情況下,請仔細查看reset()方法和延遲屬性。 –