问题是这样的:
在CCScene里放一个CCArmature,然后play,这没有问题
然后把这个CCArmature::removeFromParent,之后重新Add到场景里,再播放,就只能显示一个固定帧,无法播放帧序列了
请问这是什么问题,有办法解决么
使用的场景是:
我在CCScene里需要用到一堆CCArmature,所以做了一个内存池来定时回收它们(从场景里移除掉,等用的时候再加回去)。避免出现大量内存碎片
当用完再加回CCScene里的时候,就出问题了
内存管理没有问题,因为所有的Armature在构造出来之后,马上就存在一个Array里了,不会因为removeFromParent而被删除内存
附一段用来播放的代码
void GameTouchArmature::show(CCPoint pos)
{
this->setPosition(pos);
CCDirector::sharedDirector()->getRunningScene()->addChild(this);
this->getAnimation()->play(“anger_full_high”);
CCCallFunc *finishCallback = CCCallFunc::create(this, callfunc_selector(GameTouchArmature::hide));
CCDelayTime *delayTime = CCDelayTime::create(0.3f);
this->runAction(CCSequence::createWithTwoActions(delayTime, finishCallback));
}
void GameTouchArmature::hide()
{
this->getAnimation()->stop();
removeFromParent();
GameEngine::getInstance()->touchEngine->amaturePutBack(this);
}