dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to work with milliseconds ?

  1. #1
    I've made a countdown timer (to count down to my graduate). It works fine, except to slow .... cause the lowest time measure is in seconds.

    I want to add milliseconds to it, but I really don't know how to do it. Can someone help ?

    Thanks

  2. #2
    Senior Member Leo Lima's Avatar
    Join Date
    Jul 2000
    Location
    São Paulo, Brazil
    Posts
    745
    This code works in a kinda fast way:
    Code:
    onClipEvent (load) {
    	//sets my graduation to Sat Dec 4 21:00:00 GMT-0300 2004
    	graduation = new Date (2004, 11, 4, 21, 0, 0,0);
    	trace("My graduation is " + graduation.toString());
    	trace("Today is " + (new Date()).toString());
    }
    
    onClipEvent (enterFrame) {
    	now = new Date();
    	d = graduation.getTime() - now.getTime();
    	day = Math.floor((d/1000/60/60)/24);
    	hour = Math.abs(day * 24 - Math.floor(d/1000/60/60));
    	min = Math.floor(((d/1000)/60)%60);
    	sec = Math.floor((d/1000)%60);
    	msec = d%1000;
    }

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