title: IF statement to end the game
body: <p>So basically I have a button which moves to a random location on the screen based off a timer. </p>
  
  <p>What if statement would be correct to end the game if the person doesn't click the button before it moves to the new location?</p>
  
  <pre><code>import flash.utils.Timer;
  import flash.events.TimerEvent;
  
  stop();
  
  var timmyTimer:Timer = new Timer(3000)
  var score:int = 0;
  
  
  timmyTimer.addEventListener(TimerEvent.TIMER, tick)
  Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;                         
  
  timmyTimer.start();
  
  function tick(t:TimerEvent):void {
  if(t.target.delay &gt; 500){ 
  t.target.delay -= 100; }
  addChild(mcBall);
  mcBall.x = Math.floor(Math.random() *(stage.stageWidth - mcBall.width));
  mcBall.y = Math.floor(Math.random() *(stage.stageHeight - mcBall.height));
  mcBall.nextFrame();
  }
  
  stop();
  
  mcBall.addEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler);
  
  function fl_TapHandler(event:TouchEvent):void {
  timmyTimer.reset();
  score +=1;
  updateScores();
  mcBall.x = Math.floor(Math.random() *(stage.stageWidth - mcBall.width));
  mcBall.y = Math.floor(Math.random() *(stage.stageHeight - mcBall.height));
  mcBall.nextFrame();
  removeChild(mcBall);
  }
  
  function updateScores():void {
  lblScore.text = String(score);
  }
  
  function endGame():void {
  timmyTimer.stop();
  gotoAndStop(3);
  mcBall.removeEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler);
  removeEventListener(TimerEvent.TIMER, tick);
  removeEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler);
                              removeChild(mcBall);
  }
  </code></pre>