1 Reply Latest reply on May 24, 2015 7:25 PM by Ned Murphy

    nan error


      Hello, I am trying to create a simple math problem in cs6 flash.  This is what I have but I keep getting a error for "not a number" nan in the total box.


      I have 3 input text boxes with variables set with the names of them and a dynamic box with a variable name as answer.  I also have a button which is label calculate which calculates the answer after the 3 boxes have numbers in them which then pushes the answer to the answer box.  This is the actions I have in the button


      on (release) {

      answer = Number(firstnumber) + Number(secondnumber) / Number(thirdnumber) * 1.5;




      Hopefully that makes sense, any help would be great.


        • 1. Re: nan error
          Ned Murphy Adobe Community Professional & MVP

          A few recommendations...


          1) don't use the variable property of the textfield - it is not reliable.  Just reference its text property using the textfield instance name to acquire and assign the values.


          2) don't place code "on" objects - put it in the timeline instead where it is easier to find the code and target objects.


               btnName.onRelease = function(){

                    answer.text = String(Number(firstnumber.text) + Number(secondnumber.text) + Number(thirdnumber.text));



          3) make sure the textfields are single line, not multiline.