I need to be able to detect if the input a user types into an Input text field is not a number (NaN). I thought this would be a breeze, but I am having trouble. First I created a function that sets a new variable equal to the input value multiplied by 1.
valuetest = value*1;
For testing purposes I placed a temp text box on the stage (var: valuetest). Sure enough, when the function is called and if value contains anything but numbers, valuetest becomes NaN. Then later on the timeline I check what valuetest is.
if (valuetest == "NaN") {
gotoAndPlay("error"); }
Does not do what it supposed to. I tried doing this several ways, including putting all the code into the function, but I can not get it to “see” the NaN as a variable. I replaced the “NaN” in the if statement with a number and it works when I input that number… so I suspect that the code is correct and the problem has to be something to do with how Flash deals with a NaN output. ???
I really could use some help on this, if anyone is willing.
Thanks!