I need to somehow make the numbers after +, -, *, / in the variable "num2" Any ideas? I am new to actionscript and have not found a solution in a book or on the Internet: / A Java tag has been added because the flash section is almost dead, and I believe that the solution will be the same in both languages, if I'm wrong, tell me and I will remove the tag; )

function equals(evt:MouseEvent) {
if (action == plus) {
text_field.text = text_field.text + "=" + (num1 + num2);
}
else if (action == minus) {
text_field.text = text_field.text + "=" + (num1 - num2);
}
else if (action == divide) {
text_field.text = text_field.text + "=" + (num1 / num2);
}
else if (action == multiply) {
text_field.text = text_field.text + "=" + (num1 * num2);
}
}
function plus(evt:MouseEvent) {
action = plus;
num1 = parseInt(text_field.text);
text_field.text = text_field.text + '+';
}
source
share