lundi 13 juin 2016

how to stop countdown timer from looping when frames loop Actionscript 3.0

I am currently creating a game that requires a countdown timer which starts at 60seconds, however the timer consistently loops itself after 4 seconds.

Below is the code that I've used in Adobe Animate and it constantly loops when frames complete

import flash.utils.Timer;

var count:Number = 60;
var myTimer:Timer = new Timer(1000,count);
myTimer.addEventListener (TimerEvent.TIMER, countdown);

function countdown(event:TimerEvent) : void
Timer_txt.text = String ((count)-myTimer.currentCount + " seconds");

Aucun commentaire:

Enregistrer un commentaire