Killing Actuate delayed calls

Hi,
I am using Actuate and I need to kill a delayed call to a specific function:
I started with the obvious approach

Actuate.delay(2).onComplete(function);

But I had no references to stop the delay, so I used a dirty trick

Actuate.tween(delayedCallDummy, 2, {}).onComplete(function);

where delayedCallDummy is a Sprite, and to stop/kill the delayed call I do

Actuate.stop(delayedCallDummy);

It is an ugly trick, and it partially works, because it forces the tween to complete, event if the parameter “complete” is set to false (a bug?).
Is there a better way of doing this?

Actuate.stop(delayedCallDummy, null, false, false) will stop without calling callback.

event if the parameter “complete” is set to false (a bug?).

actually you should set sendEvent to false.

1 Like

Oh, ok, sendEvent is what I need, thank you @restorer!
Anyway, is there a better way to kill a delayed call without using a dummy?

Anyway, is there a better way to kill a delayed call without using a dummy?

No.
But tween target doesn’t need to be sprite, it can be any object, for example

var delayedCallDummy = new Dynamic();

Or you can try different tweening library, for example Delta.

Have you tried this ? :slight_smile:

You are right, it seems that it is actually possible. Just as you I was confused by private stop() in GenericActuator :smile:

for @GiG :

var tween = Actuate.timer(2).onComplete(function);

...

Actuate.stop(tween);
Actuate.stop(tween, null, false, false);

?

Yep, it should work.

It works.

About Delta, I should give it a try, like TweenX.