tsurubaso
(tsurubaso)
1
Hello to all,
I am testing Haxe.
var timer = new haxe.Timer(10); // 10ms delay
var now = Date.now();
timer.run = function() {trace(now.getSeconds); }
timer.stop;
I will have 2 questions:
-
this create an infinite loop, not good I know,
how to stop an infinite loop on Haxe.
-
It is not the equivalent of Time.sleep() from Python.
what wuold just sleep the script for a determined time?
Thanks.
kLabz
(Rudy Ges)
2
You probably meant timer.stop();
and now.getSeconds()
.
What target(s) are you using? If it’s a sys one (python for example), you can do Sys.sleep(1.5)
to wait 1.5 seconds
tsurubaso
(tsurubaso)
3
KLabz Thanks your answer.
-What target(s) are you using?
I have no specific target yet, just running codes of the API to learn what we can do or not.
To be Franc, I don’t understand yet how to export my code to an other language.
But that’s an other adventure,
Now I am just staying in Haxe and trying a few trikes.
There is no Haxe language equivalent of Sys.sleep(1.5)???
But wait…I will try that …
kLabz
(Rudy Ges)
4
If you’re not using any specific target, you’re probably using eval target. It should work there
1 Like
dean
5
this will stop it after running once
timer.run = function() { timer.stop(); }
1 Like
kLabz
(Rudy Ges)
6
Yep. There’s Timer.delay(function() { /* some code */ }, 10)
shorthand for that, too.
2 Likes
tsurubaso
(tsurubaso)
7
Sys.sleep(1.5); is working like a charme.
@dean @kLabz Thanks
1 Like