title: AS3 - Pausing on loss of focus
body: <p>I'm working on a Flash mobile game. If the app loses focus (a call comes in for example) I need the game timer to stop until focus is restored. Here is my current code but I'm getting a "Argument count mismatch error" onDeactivate(). Expected 0, got 1.</p>
  
  <p>Here is the related code, I think:</p>
  
  <pre><code>addEventListener(Event.ACTIVATE, onActivate);
  addEventListener(Event.DEACTIVATE,onDeactivate);
  
  public function onActivate():void {
      addEventListener(Event.ENTER_FRAME, showTime);
  }
  
  public function onDeactivate():void {
      removeEventListener(Event.ENTER_FRAME, showTime);
  }
  </code></pre>
  
  <p>I'm getting the error when testing in flash and I close the window. What am I missing? Thanks for any help you can offer.</p>