title: Asynchronous download of image in cocos2D
body: <p>I have used the CCSprite and giving image  which is present in the project using the function <code>spriteWithFile</code>. Now I want to download the image from the server and load it onto a CCSprite in cocos2D game scene. What are good alternatives. Please suggest.</p>
  
  <p>I am using this code and its not working : </p>
  
  <pre><code>NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://50.62.138.228:6026/1370user.jpg"]]];
      NSURLResponse *response;
      NSError *error;
      NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error];
      CCTexture2D *texture = [[CCTexture2D alloc] initWithData:responseData
                                                   pixelFormat:kCCTexture2DPixelFormat_RGBA8888
                                                    pixelsWide:50
                                                    pixelsHigh:50
                                                   contentSize:CGSizeMake(50, 50)];
      sprite_Temp = [CCSprite spriteWithTexture:texture];
      sprite_Temp.position=ccp(432,273);
      [self addChild:sprite_Temp z:5];
  </code></pre>
  
  <p>Thanks in advance.</p>