the spriteFrameByName did not work

the spriteFrameByName did not work
0.0 0


I use the cache to store the pictures, but every time it will run the mistake below:

CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache();
CCArray animFrames = CCArray::arrayWithCapacity;
char str[64] = ;
frame = cache~~>spriteFrameByName; // why the frame is NULL? it seems spriteFrameByName does not work

I have searched and it seems no guys have this problem?

mistake.png (10.1 KB)


You don’t have a path. Maybe it might work if you put your content in the same place as the executable.


I have a native path and it still does not work. Then at last I used CCTextureCache::sharedTextureCache() instead and it worked. It really confused me very much.
thanks a lot even though I still know why.:slight_smile: