Ok, I’ll describe what’s happening in both of our scripts to help explain how to get your script to work.
My original script:
enter.onRelease = function() {
String(input);
output = parseInt(input, 10);
};
Ok, so basically, when the user clicks the SUBMIT (or enter button), the onRelease method is run. This first converts the inputted number (variable “input” in this case) into a string, which is required for the parseInt function. Next, you set the variable “output” to the result of the parseInt function, which converts the inputted string to a decimal integer. Keep in mind that all of this happens only AFTER the user has clicked the submit/enter button.
Here’s your script:
String(input);
test = parseInt(input, 10);
enter.onRelease = function() {
output = test
};
First, the variable “input” is converted into a string, but the user hasn’t clicked submit/enter yet, so “input” contains either random gibberish, or is undefined. Next the variable “test” is set to the result of the parseInt function. Well, the parseInt function return “NaN” if it runs into an error (I think NaN stands for Not a Number). Then, when the user clicks the button, the onRelease method is run which sets the “output” variable to NaN, which is probably what you see, right?
So you can see that the only difference between our scripts is when they are run. The “input” variable has to be converted to a string AFTER the user has clicked submit. Then the string has to be parsed after that.
You can, of course, rename any of the variables “input” and “output” to whatever you want, just keep in mind when specific events occur. In this case, everything has to occur AFTER the user clicks the button. I’m not 100% sure what you’re trying to achieve, so if you can describe it maybe I can help further.
-Al