title: AS3 time that needs to pause
body: <p>I'm working on a mobile game and need the game clock to pause when the game loses focus, for example when  call comes in. I have everything working except that when the game gains focus again the time adjusts to as if it had been running the whole time. If someone is on a 3 minute call when they get back they should find the game time where it was.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    public function showTime(event:Event){
              gameTime = getTimer()-gameStartTime;
              timeDisplay.text = "Time: "+clockTime(gameTime);
          }
  
      public function clockTime(ms:int) {
          var seconds:int = Math.floor(ms/1000);
          var minutes:int = Math.floor(seconds/60);
          seconds -= minutes*60;
  
          var timeString:String = minutes+":"+String(seconds+100).substr(1,2);
          return timeString;
      }
  
  
      public function onActivate(event:Event):void {
          addEventListener(Event.ENTER_FRAME, showTime);
      }
  
  
      public function onDeactivate(event:Event):void {
          removeEventListener(Event.ENTER_FRAME, showTime);
      }
  </code></pre>
  
  <p>I've been Googling this for two days and am stuck. Could someone please point me in the right direction? Some sample code would be a benefit too since I'm pretty new to AS3. Thanks!</p>
  
  <p>Rich</p>