5 Replies Latest reply on Jul 14, 2006 4:47 AM by Bart Vanhulle

    Help with new syntax

    ekokurtz
      This used to work fine until moving from beta 3 to the public release - any ideas?

      isNaN(censusArray .birthyear) == false

      now I get '1067: Implicit coercion of a value of type Boolean to an unrelated type Number.'

      have tried == 0, == 'false', == '0', but no dice and no examples of having it evaluate to false - anyone have an idea?

      Ethan
        • 1. Re: Help with new syntax
          Simeon Level 1
          You might try binding the function call to a label or tracing its output so that you can see what it is returning.

          <mx:Label text="{isNaN(censusArray.birthyear)}" />

          Then you can do your comparison.

          HTH
          • 2. Re: Help with new syntax
            ekokurtz Level 1
            looks like it's something to do with the comparison operator - getting the same error with different syntax (it does out 'false')

            why does something like this quit working right from beta 3 to the public release?
            • 3. Re: Help with new syntax
              ekokurtz Level 1
              looks like it's something to do with the comparison operator - getting the same error with different syntax (it does output 'false')

              why does something like this quit working right from beta 3 to the public release?
              • 4. Help with new syntax
                ekokurtz Level 1
                I've isolated the problem, and it must be a variable typing issue that is causing the problem, but I don't know why. Anyone have an idea?

                - problem in bold (I know the item reference should use brackets but didn't want it to show up here as italic)

                if (censusArray(i).birthyear != '') {
                if ( isNaN(censusArray(i).birthyear) == false & (censusArray(i).birthyear.length == 2)) { // check birthdays
                var tempBY:Number = tempBY + 1;
                }
                }

                Error is '1067: Implicit coercion of a value of type Boolean to an unrelated type Number.'

                This also gives the same error:

                if (censusInfo.enabled == false)
                • 5. Re: Help with new syntax
                  Bart Vanhulle
                  I don't know why it throws an error (intended or not) but this is how I made it work:

                  if (censusArray(i).birthyear != '') {
                  if ( !isNaN(Number(censusArray(i).birthyear)) && (censusArray(i).birthyear.length == 2)) { // check birthdays
                  var tempBY:Number = tempBY + 1;
                  }
                  }

                  note also the use of && instead of &. If you use & it throws the same error.

                  B.