Skip to main content
This topic has been closed for replies.
Correct answer kglad

then use the timer class:

var t:Timer=new Timer(1000,0);

t.addEventListener(TimerEvent.TIMER,timeF);

t.start();

// use t.stop() when you hit an enemy

function timeF(e:TimerEvent):void{

// you can use t.currentCount

}

1 reply

kglad
Community Expert
Community Expert
September 26, 2013

it's easiest to use a number or int variable to keep the current score. eg,

var score:int = 0;

// and whenever you want to increase the score, call incrementScoreF and pass the amount to increment.

function incrementScoreF(n:int):void{

score+=n;

}

Participant
September 26, 2013

Thanks for the advice.

But all i really need is basically just a timer, counting up from 0.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
September 26, 2013

then use the timer class:

var t:Timer=new Timer(1000,0);

t.addEventListener(TimerEvent.TIMER,timeF);

t.start();

// use t.stop() when you hit an enemy

function timeF(e:TimerEvent):void{

// you can use t.currentCount

}