3 Replies Latest reply on Oct 12, 2012 12:48 PM by Ned Murphy

    Input Text and trace

    Naterdoo1

      Hello,

       

      I am trying to make a math equation in as2 for Flash. I want it so when someone enters a number into the input text box and presses the button, it adds up that number with another set number(5).

       

      This is the code that I have for the stage.

       

      var number2:Number = 5;

      var number1:Number = parseInt(text_txt.text);

       

      button_btn.onRelease = function()

      {

          trace(number1 + number2);

      };

       

      button_btn is the instance name button that I press.

      text_txt is the instance name for the input text

       

      In the output box is just says NaN(not a number). It doesn't matter what number I put in for the text box.

       

      When I switch the parseInt(text_txt.text) with a number it works perfectly fine but in that way it doesn't use the input text box

       

      Take in note that I am still very much a noob at Flash. I know very little about coding.

       

      Thanks in advance for whoever can help.