Skip to main content
July 16, 2014
Question

getTimer seems to reset in one of my movies?!

  • July 16, 2014
  • 1 reply
  • 217 views

Hi All

I have an AS2 fla that is an online chatroom. There is supposed to be a timer in the corner that counts how long the room has been running. Recently it developed some problem and is not showing the time properly.

Investigating, the code I have is quite simple:

_root.onEnterFrame = function() {

adminPanel.SessionTimer.text = getTimer() + "ms";

}

The issue I'm having is that the relevant textbox is just flickering a 1, or sometimes blank?!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 16, 2014

embed your font.

and you shouldn't be updating that many times per second and you shouldn't be displaying milliseconds.

update about 1/second and display seconds.

July 17, 2014

That could well be the solution; I was ignoring a warning about the fla containing a font that was not on my system - i didn't realise it would have such an impact.

Re the code pointer, many thanks - this isn't my code alas and I don't think I'd have done things this way. I'll have a look to see if there's a proper Timer class or something I can use to regularly run a now - startTime calc and display a to-the-seconds precision timer instead

kglad
Community Expert
Community Expert
July 17, 2014

use;

clearInterval(timerI);

timerI=setInterval(timerF,1000);

function timerF():Void{

adminPanelSessionTimer.text=Math.floor(getTimer()/1000)+" sec";

}