title: Change png that is used by sprite
body: <p>In cocos2d-x, how can I change the png that is used by a sprite?</p>
  
  <p>The following works, however it seems a bit longwinded and I was wondering if there is an alternative that prevents me from having to call <code>new</code>?</p>
  
  <pre><code>// create sprite with original png
  m_pSpr = CCSprite::create( "1.png" );
  m_pSpr-&gt;setPosition( ccp( 100, 100 ) );
  this-&gt;addChild( m_pSpr );
  
  // now change the png that is used by the sprite
  
  // new image from png file
  CCImage* img = new CCImage();
  img-&gt;initWithImageFile( "2.png", CCImage::kFmtPng );
  
  // new texture from image
  CCTexture2D* tex = new CCTexture2D();
  tex-&gt;initWithImage( img );
  
  // finally change texture of sprite
  m_pSpr-&gt;setTexture( tex );
  </code></pre>