Skip to main content
Known Participant
July 5, 2010
Answered

finding if integer

  • July 5, 2010
  • 1 reply
  • 737 views

hi, i want to know if a number in a variable type 'number' is an integer. i can do this by checking that modulus after divission by 1 is zero, but since 'number' can be anything (int, float etc) i have no idea if it can fail due to rounding. is there a flash function to check if a number is an integer?

tnx

This topic has been closed for replies.
Correct answer Andrei1-bKoviI

For example:

var n:Number = 3;
trace(n is int); // true
n = 3.4;
trace(n is int) // false

1 reply

Andrei1-bKoviICorrect answer
Inspiring
July 5, 2010

For example:

var n:Number = 3;
trace(n is int); // true
n = 3.4;
trace(n is int) // false

Known Participant
July 5, 2010

yup, that did the trick, tnx!


Inspiring
July 5, 2010

Enjoy :-)