Hi everyone,
In a fla file (flash8) I added an "Input-text" naming the var: "varInput",
and selected "Numeral [0..9]" from "Character Embedding".
I added another input object, this time of "Dynamic -text" text type
naming the var: "varOutput". I also added a button naming its' instance name:
"btnDisplay".
In "actions" panel I wrote the following code:
Code:
btnDisplay.onRelease = function()
{
varOutput=myArr[varInput];
};
var varInput:Number=0;
var varOutput:String="";
var myArr:Array=new Array("a","b","c");
Running this code i get 2 errors (at least):
1. The input text box (varInput) accepts non numeric fonts althoug i selected only numeric
characters from the "Character Embedding"?
2.When i select: control->test movie I get an error message that says:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
btnDisplay.onRelease=function()
Total ActionScript Errors: 1 Reported Errors: 1
Can anyone explain why those 2 errors occur ?
Attached is the fla file.
Thanks
As for the first error, you'll need to restrict the values that the input text can take, in your case only numerals. Just selecting "numerals" in the font embedding area does not restrict alphabetic values from being entered. So something like this should clear that up,
PHP Code:
input.restrict = "0-9";
As for the second, try removing the code that's placed directly on the button. It's good practice to keep all the code off of objects and on it's own layer.