toNumber?

Hi all,

Is there some function that makes a string into a number? I have an animation where I’d like the user to be able to input a number and then I need to do calculations on that number, but it’s not letting me at the moment because the Input Text field gives me a String. Does anyone know how to change this into a number? It would be greatly appreciated, thanks in advance! :wink:

Steve

I believe that there is a way of doing that… I’ll see what I can find.

Number(string);

thank you Supra… amazing mind as always…

Thanks, that worked and now I can add numbers from input together and display the result, which is what I wanted. But now I’m running into this problem where they won’t compare.

Say I have three input fields, var1, var2, and var3. I want to make it so that it checks if the sum of var1 and var2 == var3. But for some reason when I try it, it never says it works.

Does anyone know what’s wrong?

Steve

if(var1 + var2 == var3){…

if that’s not evaluating as true, chances are that var1 plus var2 doesn’t equal var3.

try using trace(var1+" ; “+var2+” ; "+var3); right before your if statement. that way you can be sure that you’re getting the right numbers in the right places.