Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal Places

Status
Not open for further replies.
Dec 24, 2001
857
GB
I've been working on my preloader and added a few more things to it:

* Time Passed
* Time Remaining
* Transfer Rate

Anyway, the time passed is fine because it goes up in seconds, but the transfer rate and time remaining have loads of numbers after the decimal point i.e. 71.434563323k

If I set them both as integers, they don't look very good, so I want to set them to 2dp, i.e. the number above would appear as 71.43k etc

Any help appreciated...

Aw yeah, before I forget, I use Flash 5.

Rgds
 
Here's a function that does what you need:

function roundOff(amount) {
amount *= 100;
amount = Math.round(amount);
amount /= 100;
return amount;
}



Slainte

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top