Calculator needs help

I’m making a calculator using Flash MX that works the same way as the basic calculator found on windows (not the scientific one). But having the user input a number, store it as a variable, store which function the user wants to perform and clear the text field then store the new input in the same text field as a different variable and multiply or add or divide or subtract the 2 numbers and getting the equals sign to display the answer when clicked is harder than I thought it would be. I’d appreciate any help I can get. Thanks.

  • rebel13459

Oh yeah, the user input isn’t from the keyboard, just from clicking on number buttons I created

sooo… why don’t you post some code because i can’t read your mind… i know its sad but some day i will be able too, someday… :smirk:

A quick brain dump…

Make a global variable for what function is being performed and the overall answer, so you can avoid doing the calculations in the textbox.

Let them input what they want, then when they press a function button, store the value of the textbox in the answerVar, and the function type in the functionVar.
[URL=“http://www.actionscripts.org/showMovie.php?id=1225”]
Clear your textbox, then more input and a function press. If it’s anything other than equals, Do “answerVar = answerVar functionVar textboxText”. If it is equals, output answerVar to the textbox.

If you’re not doing it for your own learning, you might want to consider grabbing something off the net, just to save time. Eg. http://www.actionscripts.org/showMovie.php?id=1225