title: AS3: Problem addressing movie clips in an array!
body: <p>I'm using loops to create a grid of movie clips. The clips are stored in an array <code>tileArray</code>.<br>
  Here is my code:  </p>
  
  <pre><code>//Spawn Checkers
  var i:int = new int();
  var j:int = new int();
  var tileArray:Array = new Array();
  for (i=0; i&lt;22; i++)
  {
      for (j=0; j&lt;12; j++)
      {
          var tile:checker = new checker(i * 25 + 49,j * 25 + 40);
          stage.addChild(tile);
          tileArray.push(tile);
      }
  }
  //Activate Checkers (TEST)
  var m:int = new int();
  for (m=0; m&lt;tileArray.length; m++)
  {
      tileArray[m].gotoAndPlay(1);
  }
  </code></pre>
  
  <p>My problem is when the <code>//Activate Checkers (TEST)</code> code section is run it doesn't address the 0th element. Namely the first tile created at position (49,40). If I do <code>tileArray[0].gotoAndPlay(1);</code> it works, but for some reason the for loop will hit every tile but the first <code>checker</code> object in <code>tileArray</code>.</p>
  
  <p>e:
  When using <code>trace(m);</code> I can see that <code>m</code> does indeed start at 0, but the loop fails to execute <code>tileArray[0].gotoAndPlay(1)</code>. Additionally, if I put <code>tileArray[0].gotoAndPlay(1);</code> outside of the loop and comment out the loop none of the tiles animate. <code>tileArray[0].gotoAndPlay(1);</code> doesn't work outside the loop, but does work inside - except when the array index is my iterative variable. Very strange.</p>