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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2?'s: Rounding and Printing 1

Status
Not open for further replies.

jonu61

Technical User
Sep 16, 2003
16
US
Hi,

I have two questions. I have some variables that I need to round to the 4th decimal place. The number can range from any where between 1 through 100000. Is there anyway to round these numbers to the 4th decimal place?

Next question,
I have a print button on a frame. I want the frame to print in landscape. I have it setup now where you can print it and set whether to print in portrait or landscape manually. Is there anyway to set this up where it will automatically print in landscape? I am currently using the code:

on (release) {
print(this,"bmovie");
}
Thanks,
Jon
 
You can round to specific places by multiplying the number, rounding then dividing again. Like this:

Code:
function round(num) {
	num *= 10000;
	num = Math.round(num);
	num /= 10000;
	return num;
}
//
trace(round(0.123456789));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top