Created
July 17, 2010 12:49
-
-
Save tommedema/479482 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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