I'm trying to make some simple calculations using input from the user.
I have two input fields, a button and a dynamic textfield for showing results. What I want is for the user to write a number in the first field, then a percent in the next field. Then he/she will click the button, and the correct calculated numer will show in the result field.
I'm using this code on the button:
on (release){
var revenue:Number =input1_txt.text;
var revenuegrowth:Number = input2_txt.text;
var growth:Number =revenue * revenuegrowth / 100;
}
The problem is, it will not work the first time I click the button. It only turns out with NaN - not a number - in the result field. (at the second click on the button it works just fine)
Any ideas on how to make it work on the first click also?