1 Reply Latest reply on Aug 6, 2007 2:09 AM by chris.huston.t10

    Problem Integer and Float

    maaz_sun_james Level 1
      Hi all,
      i am having a problem in comparing a integer with a number (float and double).
      can any one help me in showing how we can Differentiate a integer and float or double in flex.

      Thanks
      Maaz
        • 1. Re: Problem Integer and Float
          chris.huston.t10 Level 3
          You can check what type a value is with the 'is' operator.

          if (someVar is Number) do something;
          else if (someVar is uint) do something else;

          You can compare them with standard comparison operators: ==, <, >

          You can convert a Number to an int or other type:

          var someInt:int = int(someNumber);

          This conversion will simply truncate the decimal portion of the Number. If you need rounding, you will need to use the Math round function.

          Vygo