A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Freeze timer

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    22

    Freeze timer

    I have a simple timer in a game and when I give it the command "timer.stop();"
    it stops. I want to pause it or something like that because when I stop it like above the timer is gone and you cant see your finish time.

    Anyone can help me out?

    Joepiooo

  2. #2
    Member
    Join Date
    Nov 2006
    Posts
    79
    Unfortenately there is not a "time"-propery on the Timer that can tell you how much time has passed or remains.
    I would solve this by setting your timer up like this:

    PHP Code:
    private var timer:Timer = new Timer(10);
    private var 
    totalTime:Number 0;

    timer.addEventListener(TimerEvent.TIMERchangeTime);

    private function 
    changeTime(e:Event)
    {
         
    totalTime =+ 0.01;

    You can now always se how much time that has passed in the totalTime-variable. It does not matter if the timer has stopped or not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center