-
[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 *!*
-
Code:
function updateTimer():Void {
currenttime = getTimer();
currenttime = Math.floor(currenttime /1000);
//Math.floor(currenttime);
trace(currenttime+ "NEWTIME");
}
var intervalID:Number = setInterval(updateTimer, 1000);
-
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);
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|