# Math Equasions

**URL:** https://forum.kirupa.com/t/math-equasions/28088
**Category:** flash
**Created:** [August 10, 2003, 12:09am UTC](https://forum.kirupa.com/t/math-equasions/28088 "2003-08-10T00:09:59Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mikenash87](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mikenash87](https://forum.kirupa.com/u/mikenash87)
#### Post date: [August 10, 2003, 12:09am UTC](https://forum.kirupa.com/t/math-equasions/28088/1 "2003-08-10T00:09:59Z")

</div>

Can someone explain to me how I can set up an an application so that when a person types “3” in one text box and types “4” in another box, I can get another box to automatically give me what they add up to…  
I understand if I have three text boxes… giving var names of “a”,“b”, and “c” I could do…

a=2\*3  
b=3+4  
c=a+b

However that is me typing in the value of “a” and “b”.  
How can I do it so another person can type in the two values so “C” can calculate the value?

---

<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: [August 10, 2003, 12:50am UTC](https://forum.kirupa.com/t/math-equasions/28088/2 "2003-08-10T00:50:38Z")

</div>

As easy as one, two, three… 😉  
[AS]// define addition function  
addition = function () {  
// convert string to number  
var a = a\_txt.length ? parseInt(a\_txt.text) : 0;  
var b = b\_txt.length ? parseInt(b\_txt.text) : 0;  
// do I need to explain this line? :\*\*\*\*P  
c\_txt.text = a+b;  
};  
// create TextFields  
this.createTextField(“a\_txt”, 0, 0, 0, 80, 16);  
this.createTextField(“b\_txt”, 1, 100, 0, 80, 16);  
this.createTextField(“c\_txt”, 2, 200, 0, 80, 16);  
// set text format  
a\_txt.setNewTextFormat(new TextFormat(“Verdana”, 10));  
b\_txt.setNewTextFormat(new TextFormat(“Verdana”, 10));  
c\_txt.setNewTextFormat(new TextFormat(“Verdana”, 10));  
// set TextField type to input  
a\_txt.type = “input”;  
b\_txt.type = “input”;  
// admit characters only from 0 to 9 and .  
a\_txt.restrict = “0-9.”;  
b\_txt.restrict = “0-9.”;  
// show TextField border  
a\_txt.border = true;  
b\_txt.border = true;  
// call function  
a\_txt.onChanged = addition;  
b\_txt.onChanged = addition;[/AS]  
Of course, you can manually create the TextFields, I just didn’t want to attach a FLA. =)

---

<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: [August 10, 2003, 1:03am UTC](https://forum.kirupa.com/t/math-equasions/28088/3 "2003-08-10T01:03:15Z")

</div>

thank you 🙂

---

<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: [August 10, 2003, 1:17am UTC](https://forum.kirupa.com/t/math-equasions/28088/4 "2003-08-10T01:17:46Z")

</div>

You’re welcome, mike. 😛

---

<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: [August 10, 2003, 1:21am UTC](https://forum.kirupa.com/t/math-equasions/28088/5 "2003-08-10T01:21:23Z")

</div>

Kax, how the hell do you know so much AS!??!?! Tell me now!!! 😱

---

<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: [August 10, 2003, 1:30am UTC](https://forum.kirupa.com/t/math-equasions/28088/6 "2003-08-10T01:30:44Z")

</div>

Where did you learn all these commands,kax?

---

<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: [August 10, 2003, 1:30am UTC](https://forum.kirupa.com/t/math-equasions/28088/7 "2003-08-10T01:30:54Z")

</div>

That’s a really simple question, my dear friend… =)

I have no life. 😛

Seriously now, I’m experimenting all day, or at least whenever I’m not working. Also, I’ve learned a lot from all of you and helping people. 😉  
There’s no secret, there are sources all over the web.

…And patience helps a lot too. 😛
