Convert Input Text to Number in Actionscript 2.0

Discussion in 'Web Design and Development' started by Rodie1952, Nov 12, 2009.

  1. Rodie1952 macrumors newbie

    Joined:
    Nov 12, 2009
    #1
    I am a relative newcomer to Actionscript 2.0 and Flash I have created a Input test box where a student can input the answer to a mathematical equation i.e. 1+1= Input Text Box variable. The problem is when I check the correct answer to the Input Number Flash treats in Input as text not a numerical value. How do I get the input to be treated as numerical?
     
  2. lucidmedia macrumors 6502a

    Joined:
    Oct 13, 2008
    Location:
    Wellington, New Zealand
    #2
    Both of the solutions *should* work for As2. The bottom method (casting) also works for As3.

    myNum=parseInt(myString);

    myNum=Number(myString);
     
  3. Rodie1952 thread starter macrumors newbie

    Joined:
    Nov 12, 2009
    #3
    "should" was the key word.

    Sorry, that didn't work. I should add this is inside a movieclip if that makes any difference.
     
  4. samwich macrumors regular

    Joined:
    Aug 5, 2007
  5. Ride9650 macrumors 6502

    Joined:
    Jun 29, 2007
    #5
    It can.

    Did you try the code on the main timeline or the timeline for the movieclip?
     

Share This Page