title: AS3 collision dectection mouse movement
body: <p>I am making a game which uses collision detection with the mouse.</p>
  
  <p>The player is a custom mouse cursor when the mouse collies with an object the mouse is moved to the coordinates X0,Y0. The code I have used to achieve this is below. However when the mouse is moved to X0,Y0 after a collision when the mouse is moved it starts back where the collision took place rather than moving from the top of the screen. </p>
  
  <pre><code>import flash.events.Event;
  
  var cursor:MovieClip;
  
  function initializeMovie ():void {
  
  cursor = new Cursor();
  addChild (cursor);
  cursor.enabled = false;
  Mouse.hide ();
  stage.addEventListener (MouseEvent.MOUSE_MOVE, dragCursor);
  }
  
  function dragCursor (event:MouseEvent):void{
  
  cursor.x = this.mouseX;
  cursor.y = this.mouseY;
  }
  
  initializeMovie ();
  
  this.addEventListener( Event.ENTER_FRAME, handleCollision)
  
  function handleCollision( e:Event ):void{
  
  if(cursor.hitTestObject( wall )){
  cursor.x = 0
  cursor.y = 0
       }
  
  }
  </code></pre>