stopAction() v3.17.2

Hi guys, can i get a little help please?

if i create a Sequence:

auto cb = CallFuncN::create(CC_CALLBACK_0(animationEnd, this));
cb->setTag(someID);
auto seq = Sequence::create(animate, cb, nullptr);
sprite->runAction(seq);

lets say i want to intercept this seq and stop it how do i do that?

i have tried:

sprite->stopAllActions();
sprite->stopActionByTag(someID);

but the callback is still getting called.

i have also set the tag to the sequence. same results;

it looks like its a bug.

thanks in advance!

You’ve created a sequence of actions, and each action has a specific duration. When you try to stop the Sequence action on the sprite (stopAllActions), the sequence would stop at whatever point in time it is up to in whichever sequence action it is running. The only way you’re able to stop the callback action is if you happen to stop it before the animate action is complete.

Using sprite->stopActionByTag() may not be working because it is only checking the action set by sprite->runAction(), and not the sub-actions of the sequence. That isn’t a bug, but rather by design.

In this case you may need to re-think your design and implementation.

2 Likes

Thank you a lot. i think this is my problem.