Forum Topic: how to round numbers

(165 views • 8 replies)

This topic is 1 page long.

<< < > >>
None

TehdeAnus

Reply To Post Reply & Quote

Posted at: 6/9/09 04:15 PM

TehdeAnus FAB LEVEL 01

Sign-Up: 06/08/09

Posts: 12

when i make a preloader the outcome is for example

LOADING: 41.5674657984365879376523%

how do i get rid of the decimal places?

As you can probably see, I'm not too shy about flaunting my nationality.
LONG LIVE TEHDE SHITE!

BBS Signature

None

UnknownFury

Reply To Post Reply & Quote

Posted at: 6/9/09 04:16 PM

UnknownFury EVIL LEVEL 26

Sign-Up: 08/10/05

Posts: 6,031

Math.round(#);

Portfolio(Under construction): UnknownFury.com |
Msn: giant_ak_47@msn.com | Contact: me@unknownfury.com
Follow me on twitter!


Questioning

TehdeAnus

Reply To Post Reply & Quote

Posted at: 6/9/09 04:33 PM

TehdeAnus FAB LEVEL 01

Sign-Up: 06/08/09

Posts: 12

in what context is that?

As you can probably see, I'm not too shy about flaunting my nationality.
LONG LIVE TEHDE SHITE!

BBS Signature

None

Paranoia

Reply To Post Reply & Quote

Posted at: 6/9/09 04:37 PM

Paranoia DARK LEVEL 33

Sign-Up: 04/22/05

Posts: 9,692

The number you want to round goes inside the brackets and the whole thing returns the rounded number...

BBS Signature

None

sasuke2910

Reply To Post Reply & Quote

Posted at: 6/9/09 04:44 PM

sasuke2910 LIGHT LEVEL 08

Sign-Up: 06/11/06

Posts: 1,657

Well let's see your loading script.

BBS Signature

None

Afro-Ninja

Reply To Post Reply & Quote

Posted at: 6/9/09 06:17 PM

Afro-Ninja EVIL LEVEL 37

Sign-Up: 03/02/02

Posts: 13,466

At 6/9/09 04:16 PM, UnknownFury wrote: Math.round(#);

You'd probably want to use Math.floor(num);

if the loading percent is 99.55, that will be rounded to 100 and will imply that the movie is fully loaded when it is not

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 6/9/09 11:49 PM

Yambanshee DARK LEVEL 10

Sign-Up: 10/05/08

Posts: 1,425

perLoaded = Math.floor(perLoaded)

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

gumOnShoe

Reply To Post Reply & Quote

Posted at: 6/9/09 11:51 PM

gumOnShoe LIGHT LEVEL 15

Sign-Up: 05/29/04

Posts: 13,825

Math.ceiling will always round up, in case you were wondering.

FORUM MODERATOR PM Forum Abuse to: Me :: AIM: gumOnShoeNG
Improve Your Responses >:(

BBS Signature

Elated

Zuggz

Reply To Post Reply & Quote

Posted at: 6/10/09 12:03 AM

Zuggz FAB LEVEL 16

Sign-Up: 06/23/03

Posts: 1,055

At 6/9/09 11:51 PM, gumOnShoe wrote: Math.ceiling will always round up, in case you were wondering.

Math.ceil(Number); will always round up.

Actionscript rolls like that.

|- I'm on a Boat - Collab -|- List -|- AS3 -|- Game Poll -|

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 08:08 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!