A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [MX04] Math.floor help!!

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    102

    [MX04] Math.floor help!!

    Hi! I have the below code to trace the current time in seconds. But I don't know why I can't use Math.floor to round up the "currenttime" digit...
    But I could use Math.floor(12.123);



    function updateTimer():Void {

    currenttime = getTimer();
    currenttime = currenttime /1000;
    Math.floor(currenttime);

    trace(currenttime+ "NEWTIME");

    }
    var intervalID:Number = setInterval(updateTimer, 1000);



    Can anyone please help??

    Thanks!!
    *!* I really need some help *!*

  2. #2
    Senior Member
    Join Date
    Feb 2004
    Location
    Worcester Ma
    Posts
    161
    Code:
     
    function updateTimer():Void {
    
    currenttime = getTimer();
    currenttime = Math.floor(currenttime /1000);
    //Math.floor(currenttime);
    
    trace(currenttime+ "NEWTIME");
    
    }
    var intervalID:Number = setInterval(updateTimer, 1000);

  3. #3
    :
    Join Date
    Dec 2002
    Posts
    3,518
    When calling the Math.floor function the results need to be stored back into a variable, in this case back into the currenttime variable, see below...
    Code:
    function updateTimer():Void {
    	currenttime = getTimer();
    	currenttime = currenttime/1000;
    	currenttime = Math.floor(currenttime);
    	trace(currenttime+" NEWTIME");
    }
    var intervalID:Number = setInterval(updateTimer, 1000);

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Posts
    102
    Oh I put code into wrong place...

    THANK YOU VERY VERY MUCH! YOU SAVED MY DAY!
    *!* I really need some help *!*

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