This content has been marked as final. Show 5 replies
If InputOne and InputTwo are input textFields then you need to refer to the text that's entered in those textFields using the .text property all the time. So change this line: product = Number(InputOne) + Number(InputTwo);
product = Number(InputOne.text) + Number(InputTwo.text);
if product is a variable. Then in the next line, you should use:
outputText.text = product;
if outputText is a dynamic textField and product is a variable.
Wonderful Rob. Thanks! Works very well. I was able to expand this to multiplication and division and subtraction.
One more question, in a case of division how would one restrict the answer to two decimal points? I tried a .restrict but it did not work.
also, could someone tell me how to get the percentage of one number from another?
[as] percent = Number(input1.text)%Number(input2.text); [/as]
Did not work...
I found the answer to the percentage. Never mind :)
[as] pct = Math.round((input2.text/input1.text)*100); [/as]