Hi,
I think you are looking for :
function roundToEight (pVal:Number) {
return Math.round(pVal/8)<<3;
}
although 44.9 and 44.4 will both return 48, don't you mean 43.9 and 44.4?
greetz
JC
On Thu, Dec 18, 2008 at 3:51 PM, Lehr, Ross (N-SGIS) <[email protected]>wrote:
> Oops..... TYPO!!
>
> This is it
>
> Math.round(Math.round(32.3)/8)*8
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Jiri
> Heitlager
> Sent: Thursday, December 18, 2008 8:55 AM
> To: Flash Coders List
> Subject: [Flashcoders] round number to closet value of 8
>
> I am trying to figure out the fastest way to get the closest multitude
> of 8 from a random Number
> and I am really not a math person.
>
> var tN:Number = 32.3
> //32
> var tN:Number = 32.00
> //32
> var tN:Number = 44.9
> //48
> var tN:Number = 44.4
> //40
>
> Much appreciated if someone could help me out
>
> Jiri
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders