A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Seconds/Milliseconds Timer

  1. #1
    -
    Join Date
    Feb 2006
    Posts
    74

    Seconds/Milliseconds Timer

    I need to create a timer that when button1 is pressed starts and when button two is pressed stops. It needs to record SS:MM and really needs to me 100% precise.

    Any one know the best way to write this so it is 100% precise?

  2. #2
    -
    Join Date
    Feb 2006
    Posts
    74
    I have found the following solution but can't seem to get it to work using a one button to start and another to stop. All it does is keep counting up
    Code:
    onEnterFrame = function () {
    	time = getTimer();
    	miliseconds = time;
    	minutes = Math.floor(miliseconds/1000/60);
    	miliseconds -= minutes*1000*60;
    	seconds = Math.floor(miliseconds/1000);
    	miliseconds -= seconds*1000;
    	miliRound = Math.round(miliseconds/10);
    	min = (minutes<10 ? "0" : "")+minutes;
    	sec = (seconds<10 ? "0" : "")+seconds;
    	ms  = (miliRound<10 ? "0" : "")+miliRound;
    	textbox.text = min+":"+sec+":"+ms;
    };

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