# Another AS problem

**URL:** <https://forum.kirupa.com/t/another-as-problem/2660>\
**Category:** flash\
**Created:** [May 14, 2002, 10:01pm UTC](https://forum.kirupa.com/t/another-as-problem/2660 "2002-05-14T22:01:42Z")\
**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:** [May 14, 2002, 10:01pm UTC](https://forum.kirupa.com/t/another-as-problem/2660/1 "2002-05-14T22:01:42Z")

</div>

Ok, I have two text boxes, one has a number in it (10) and the other one has -3. When i try to add the two together, i get 10-3, not 7. How do I fix this?

---

<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:** [May 15, 2002, 12:43am UTC](https://forum.kirupa.com/t/another-as-problem/2660/2 "2002-05-15T00:43:14Z")

</div>

I’m guessing you have two input boxes, or two dynamic boxes. I named the instances of mine inputa and inputb respectively. In one, I entered 10 (inputa) and in the other I entered 3 (guessing that’s what you wanted). \r\rNow… you say you wanted to substract, as in 10-3?\r\rtrace(inputa.text-inputb.text);\r\rHowever, the correct way, I believe, will be to use the number fuction…\r\rtrace(Number(inputa.text-inputb.text);\r\rboth of these will yield 7\r\rHope it helps.\r\r"My name is Inigo Montoya. You killed my father. Prepare to die!"\r

---

<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:** [May 15, 2002, 7:59am UTC](https://forum.kirupa.com/t/another-as-problem/2660/3 "2002-05-15T07:59:38Z")

</div>

thats not what I needed but it helped enough for me to figure it out. \r\rWhat I wanted to do was add two dynamic boxes, one was 10 and the other, -3 so it whould be 10+(-3) I wanted to add a negative number. The problem was it was treating the two numbers as strings instead of integers, but the Number thing worked, thanks. 😉

---

<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:** [May 15, 2002, 11:17pm UTC](https://forum.kirupa.com/t/another-as-problem/2660/4 "2002-05-15T23:17:04Z")

</div>

ok, heres my next problem. \r\r((x is a dynamic text feild))\r\r

```auto
 \r\r&nbsp &nbsp &nbsp &nbsp if (_parent.x="circle&quot;) {\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndPlay (32);\r\r&nbsp &nbsp &nbsp &nbsp } else {\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndPlay (33);\r\r&nbsp &nbsp &nbsp &nbsp }\r\r

```

\r\rFor some reason, when it runs this code, it sets x to “circle” instead of w/e else it was. \r\rI did some tests to make sure and it is deffinatly the “if (\_parent.x=“circle”) {” that changes it. \r\rAny ideas why?

---

<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:** [May 15, 2002, 11:37pm UTC](https://forum.kirupa.com/t/another-as-problem/2660/5 "2002-05-15T23:37:46Z")

</div>

change variable names. In other words, dont use x… use something else. I have to check, but x may be reserved.\r\rAlso, if you’re trying to check if a statement is true, use == \rinstead of =\r

---

<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:** [May 15, 2002, 11:55pm UTC](https://forum.kirupa.com/t/another-as-problem/2660/6 "2002-05-15T23:55:04Z")

</div>

yup, it was that second = that messed my up, I’m used to the Basic style of syntax and we dont use 2 ='s
