1 Attachment(s)
Action script: How to display array's elements
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:
Quote:
**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
Thanks a lot ! That helped me very much !
Now everything is working properly.