I create an action, and when some event happen, I let a sprite to run this action, BUT it crashes.
After I review my code, I found if I let a node to run an action, and this node’s scene have already running, it will crashes.
But if I let a node to run an action which is not in a running scene, then I let its scene running by call CCDirector::replaceScene.
It won’t crashes.
I did a test in your HelloWorld project to prove this situation.
Create an action in HelloWorld::init(), like: m_pAction = CCMoveBy::actionWithDuration(1,ccp(200,0));
change HelloWorld::menuCloseCallback to:
void HelloWorld::menuCloseCallback(CCObject* pSender)
{
pLabel->runAction(pAction);//let pLabel to be data member of class HelloWorld
}
When you click X button, it will crashes.
But if you remove “pLabel->runAction(pAction)” to HelloWorld::init(), it won’t crash, and the label is moving to right.
Did actions can’t start after the scene begin running? If so that will be too bad!
BTW, crashes at method ccArrayAppendObject.