title: How to switch the image of a CCSprite
body: <p>I have a CCSprite that is initialized using <code>[CCSprite spriteWithSpriteFrameName:@"plist_file_key_here.png"]</code>. I have already added all the sprites from my plist file to CCSpriteFrameCache. I have tried setting the texture like this:</p>
  
  <pre><code>CCSpriteFrame * frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:name];
  NSAssert(frame.texture!=nil, @"frame.texture can't equal nil"); //this works fine
  [sprite setTexture:frame.texture]; //doesn't cause a white square to appear, just doesn't switch the image.
  </code></pre>
  
  <p>As I said in my comments, this doesn't work. I think it has something to do with the difference between using <code>[CCSprite spriteWithFile:]</code> and <code>[CCSprite spriteWithSpriteFrameName:]</code>, which relies on sprite frames loaded into the CCSpriteFrameCache from a texture atlas. When using sprites loaded from a texture atlas, the texture of each sprite is equal to the texture of the sprite sheet. Is there any way around this or do I have to remove and recreate the sprite? If that is my only option, is there a way of removing a ccnode from its parent but preserving its children?</p>