Another AS problem

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?

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

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. :wink:

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

 \r\r&nbsp &nbsp &nbsp &nbsp if (_parent.x="circle")  {\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?

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

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