That’s all it takes


That’s all it takes to get the value of a text input field. It is so easy that it hardly requires any new ActionScript knowledge at all. You just have to remember to set the Var property of the text input field. Also remember that this is a global variable that only exists on the level where the field is located. So if you place it in a movie clip, you will have to refer to the variable as part of the movie clip to access it from the root level.

String Operations and Functions
Now that we can get strings from the user, it will be useful to manipulate them.

Concatenation
To combine two strings, use the + symbol. For instance, if you have a variable named myVariable and want to add something to it, just use myVariable+ and the thing you want to add. Here is an example using the Output window:

var myVariable = “Hello”;
trace(myVariable+” World.”);

Taken From: Sams Teach Yourself Flashâ„¢ MX ActionScript in 24 Hours

  • Partner links