How to can I reference a timer?

74 views
Skip to first unread message

simo

unread,
Sep 22, 2013, 4:17:22 AM9/22/13
to haxe...@googlegroups.com
Its easy to implement a timed call with Actuate like this:

Actuate.timer (1).onComplete (trace, "Hello World!");
But, what if I want to manage the created timer later, lets say stop it or pause it .. etc
How can I reference the timer above? is it possible to have multiple timers?



Alexander Kuzmenko

unread,
Sep 22, 2013, 4:40:19 AM9/22/13
to haxe...@googlegroups.com
Try this:

<code>
var timer = Actuate.timer (1).onComplete (trace, "Hello World!");
Actuate.stop(timer);
</code>

воскресенье, 22 сентября 2013 г., 12:17:22 UTC+4 пользователь simo написал:

Samir Sabri

unread,
Sep 22, 2013, 4:49:11 AM9/22/13
to haxe...@googlegroups.com
I will test it when I go home, is this a guess? or you've already tried it?


--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.



--
--
Kind Regards,
--------------------------------------------- 
Samir Sabri
Software Architect& Developer
Jordan-Middle East

glantucan con golo lojo

unread,
Sep 24, 2013, 11:25:41 AM9/24/13
to haxe...@googlegroups.com
This what I used after several trials and errors:

var _timerActuator:GenericActuator = cast Actuate.timer(1).onComplete(secondPassed);

and when I wanted to stop it  I used

_timerActuator.onComplete(null);
_timerActuator.stop(null,false, false);

I don't know if this is the best way to do it but it worked.

Samir Sabri

unread,
Sep 24, 2013, 2:31:21 PM9/24/13
to haxe...@googlegroups.com
Thank you! I found another way too:

Actuate.tween(tweenTarget, time, {} ).onComplete(aHandler);
Actuate.stop(tweenTarget, null, false, false);

notice the empty properties object {}

Reply all
Reply to author
Forward
0 new messages