cocos2d-x 2.0 question about CCAction

cocos2d-x 2.0 question about CCAction
0.0 0


here is my question, when i use 1.0 version i create a ccsprite and run a RepeatForever action than i run a finit time action the result was the sprite stop the repeat action when run once new action and keep running repeat action when the new action was stoped.
but the 2.0 version of cocos2d-x seems that the repeat action and new finit action will run simultaneously. how to fix that?
the code of an example is here:

CCSprite* spr = CCSprite::create(“spr.png”);//create a sprite
spr~~>setPosition);//set the position
this~~>addChild(spr,3,3);//add to layer
spr~~>runAction));//run a repeat for ever action
//i define a button and write the code in that button’s call back function
CCSprite* spr = this~~>getChildByTag(3);
if (spr)
spr->runAction(CCMoveBy::create(2.0f, ccp(20.0f,0.0f)));

when i press the button the sprite should stop rolling than move a little bit and keep rolling when it stop moving.
please help me to fix this problem. thanks in advance.


Since the 2 actions are acting on different operations (one is rotation, the other translating) they will work together. If you were running in the button callback a rotation action that it would have replaced the old one.
What you can do is set a tag to the rotation action and in button callback stop the action by using stopActionByTag

auto rep=CCRepeatForever::create(CCRotateBy::create(1.0f, 60.0f));

in button callback:

spr->runAction(CCMoveBy::create(2.0f, ccp(20.0f,0.0f)));


tks Cristian, i put more detail question in other subject. you can review that and helps me out.