title: hitTestObject collision detection not working in as3!
body: <p>I am trying to create a platformer game and i am trying to make "player1" stop when it hits a "platform". here is my code so far,</p>
  
  <pre><code>    gotoAndStop("gameStart");
  
  import flash.display.MovieClip;
  import flash.events.*;
  import flash.ui.Keyboard;
  import flash.ui.*;
  
  
  import flash.utils.Timer;
  import flash.events.TimerEvent;
  
  player1.gotoAndStop("nothing");
  
  
   //private var speed:Number = 0;
   //private var maxspeed:Number = 4;
  
  var myTimer:Timer = new Timer(10,0);
  
  
  stage.focus = this;
  
  
  player1.addEventListener(Event.ENTER_FRAME,enterFrameHandler);
  /*
  myTimer.addEventListener(TimerEvent.TIMER,someFunction);
  
  
  
  myTimer.start();
  
  function someFunction(event:TimerEvent) {
   player1.y += 2;
  
  
  }
  */
  
  function setup() {
   stage.addEventListener(KeyboardEvent.KEY_DOWN, reactToArrowKeys);
  }
  setup();
  
  
  function reactToArrowKeys(keyEvent:KeyboardEvent) {
  
   if (keyEvent.keyCode == 37) {
  
    if (player1.x &gt; 0) {
     player1.x -= 5;
    }
  
   } else if (keyEvent.keyCode == 39) {
  
    if (player1.x &lt; 700) {
     player1.x += 5;
    }
  
   }
  
  
  }
  
  
  function enterFrameHandler(e:Event):void {
     if (player1.hitTestObject(platform)) {
      trace("hitting");
     } else {
      player1.y += 4;
     }
    }
  </code></pre>
  
  <p>however the hitTestObject function (enterFrameHandler) does not work properly and will always take the "else" route.</p>
  
  <p>please help! </p>