# toNumber?

**URL:** https://forum.kirupa.com/t/tonumber/3526
**Category:** programming
**Created:** [November 2, 2001, 5:05am UTC](https://forum.kirupa.com/t/tonumber/3526 "2001-11-02T05:05:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2001, 5:05am UTC](https://forum.kirupa.com/t/tonumber/3526/1 "2001-11-02T05:05:58Z")

</div>

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! 😉

Steve

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2001, 6:33am UTC](https://forum.kirupa.com/t/tonumber/3526/2 "2001-11-02T06:33:52Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2001, 6:54am UTC](https://forum.kirupa.com/t/tonumber/3526/3 "2001-11-02T06:54:23Z")

</div>

Number(string);

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2001, 7:36am UTC](https://forum.kirupa.com/t/tonumber/3526/4 "2001-11-02T07:36:44Z")

</div>

thank you Supra… amazing mind as always…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2001, 10:01am UTC](https://forum.kirupa.com/t/tonumber/3526/5 "2001-11-02T10:01:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2001, 10:11am UTC](https://forum.kirupa.com/t/tonumber/3526/6 "2001-11-02T10:11:03Z")

</div>

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.
