title: As3 collision detection with a movieclip array?
body: <p>Ok my xChar.character is my character movieclip and xMap the instance of the class building the map.</p>
  
  <p>From the xMap i add movieclip sliced from a image using variable which is inside a function. I do addChild(cell1); for every object displayed on my map which is in a array.</p>
  
  <p>But the only public variable from the xMap class i can use is slicedObject which is a linear array holding all the sliced image from a movieclip (this image contain all my object that i want the character to collide with).</p>
  
  <p>So i tryed to do this:</p>
  
  <pre><code>package as3
  {
  public class wl_CollisionDetection
  {
      var tChar;
      var tMap;
      public var _CheckCollision:Boolean;
      public function wl_CollisionDetection(xChar:wl_Character,xMap:wl_MapBuilder)
      {
          tChar = xChar;
          tMap = xMap;
      }
      public function CheckCollision()
      {
          _CheckCollision = false;
          if (tChar.character.hitTestObject(tMap.sliceObject[70]))
          {
              _CheckCollision = true;
              trace("Collision detected!");
              return;
          }
          else
          {
              _CheckCollision = false;
              trace("No collision");
              return;
          }
          _CheckCollision = false;
      }
  }
  }
  </code></pre>
  
  <p>All i get is the no collision trace.</p>
  
  <pre><code>if (tChar.character.hitTestObject(tMap.sliceObject[70]))
  </code></pre>
  
  <p>What i’m doing wrong ?</p>