0

plsは助けます!ループを何度も繰り返してもタイマーが停止しない理由がわかりません。最初に変数「roundCount」を宣言しました。タイマーは、値がゼロになったときに停止する必要がありましたね。ただし、「roundCount」の値を3、2、1,0、-1、-2、-3などに減らし続けます。

var roundLength:uint = 1000;
var roundCount:uint = 0;

con_btn.addEventListener(MouseEvent.CLICK, conPoint);

function conPoint(m:MouseEvent)
{
    if (cB.height == 60)
    {
        conductSigns.conductMasker.y = 27;
        roundCount = 10;
        penaltyTimer.start();
    }
}

var penaltyTimer:Timer = new Timer(roundLength,roundCount);
penaltyTimer.addEventListener(TimerEvent.TIMER, countDown);

function countDown(t:TimerEvent):void
{
    timeOut_txt.text = String(roundCount - penaltyTimer.currentCount);
}
4

1 に答える 1

0

このコードから、roundCountは0であるため、repeatCount 0でタイマーを開始します。これは、意味があります-永久に繰り返します。http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Timer.html#Timer() また、roundCountはデクリメントされません。あなたはそれからペナルティタイムr.currentCountを差し引きます

タイマーを3回実行するには、タイマーを
作成するときにroundCountが3であることを確認する必要があります。タイマーオブジェクトの作成後に値を変更しても、タイマーには反映されません。

于 2013-02-28T15:27:54.360 に答える