Skip to content

Instantly share code, notes, and snippets.

@tommedema
Created July 17, 2010 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommedema/479482 to your computer and use it in GitHub Desktop.
Save tommedema/479482 to your computer and use it in GitHub Desktop.
package com.tommedema;
import haxe.Timer;
class DynamicTimer extends Timer
{
private var newTimer:Timer;
public function new(interval_ms:Int)
{
super(interval_ms);
}
public function restart(interval_ms:Int)
{
this.stop();
newTimer = new Timer(interval_ms);
newTimer.run = this.run;
}
public override function stop():Void {
if (newTimer == null) {
super.stop();
}
else {
newTimer.stop();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment