title: Problem with adding sprite using CCSprite array in cocos2d
body: <p>I have problem with following code.
  <pre><br>
          mySpriteArray=[[NSMutableArray alloc] init];</p>
  
  <code>    star=[CCSprite spriteWithFile:@"22.png"];
  
      for(int i=0;i&lt;10; i++) 
      {
  
          [mySpriteArray insertObject:star  atIndex:i];
  
  
      }
  
  
     // NSLog(@"x=%i",[mySpriteArray count]);
  
  
  
      for (int i=0; i&lt;10; i++) // Opponents is NSMutableArray
      {
          CCSprite *tempSprite = (CCSprite *) [mySpriteArray objectAtIndex:i];
  
  
          tempSprite.position=ccp(100,100);
  
  
          [self addChild:tempSprite];
  
  
      }
  </code></pre>
  
  <p>}
   
  where star is a object of CCSprite and mySpriteArray is a mutable array.The problem is that when i run the program it crash and say</p>
  
  <p></p>
  
  <p><strong>* Assertion failure in -[GameScene addChild:z:tag:], /Users/salimsazzad/Desktop/balon hunter/libs/cocos2d/CCNode.m:305
  2010-10-08 19:05:35.854 balon hunter[3967:207] *</strong> Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'child already added. It can't be added again'.</p>
  
  <p>i can't understand whats wrong,i am adding 10 object,not 1 object in 10 times because  CCSprite *tempSprite = (CCSprite *) [mySpriteArray objectAtIndex:i];creating a new object each time.
  so what is the problem???</p>