就下面两三句代码,在Windows下运行着挺好的,为什么手机上就不行
int randomNumber = HelloWorld::random(0,mAnimationArray->count());
CCLog(“ramdom index %d”,randomNumber);
const char animName = dynamic_cast<CCString>( mAnimationArray->objectAtIndex(randomNumber))->getCString();
CCAnimation *animation = CCAnimationCache::sharedAnimationCache()->animationByName(animName);
CCAnimation newAnim = (CCAnimation)animation->copy()->autorelease();
/* CCAnimation newAnim = CCAnimation::create(animation->getFrames(), animation->getDelayPerUnit(), animation->getLoops());
newAnim->setRestoreOriginalFrame(false);/
int showNumber = 1;//HelloWorld::random(2,5);
for(int i = 0; i < showNumber; i++)
{
int x = HelloWorld::random(50,850);
int y = HelloWorld::random(50,500);
CCSprite *sprite = CCSprite::create();
sprite->runAction(CCAnimate::create(newAnim));
sprite->setAnchorPoint(ccp(0.5,0.5));
sprite->setPosition(ccp(x,y));
this->addChild(sprite);
}
