flash maths q
flash maths q
- Started
- Last post
- 6 Responses
- lnu
Hi.
What is the syntax for extracting "even hundreds" from a variable in flash; i.e. i want to use the xmouse value - if it's 100 to 199 i wan't to convert it to 100, if it's 273 I want to convert it to 200, if it's 314 to 300 and so on...
?
Thanks.
- JamesEngage0
if your number is 'a' do
(Math.floor(a/100))*100
- lnu0
excellent.
- dessalles0
or, slightly more efficiently:
a - a%100;
- JamesEngage0
hey that is neat... I'm always to nervous to use stuff like that... it's like sorcery or something
- guiles0
"sorcery" - that's great =D
- dessalles0
it's a much lower level operation. and considering he's reading in mouse data, he'll have a much higher sample rate if he uses it.
well actually, i don't think it'll really make much of a difference. it just looks smarter. : )