Declare a number variable with a variable declaration statement. Use a var statement to assign a name to the variable and specify the type of variable as number. Use the general AS3 code syntax to declare a number variable as follows:
var <variable name>: Number
For example to declare a number variable that has been given an arbitrary name of "A" use the code
var A:Number
Assign a decimal number to the number variable. For example, to assign (or store) the number 3.14 in a variable called "A" use the code
A = 3.14
Perform multiplication calculations with the multiplier ope rater "*." For example, to multiply the numbers stored in two number variables, A and B, and store them in a third number variable named C, use the code
C = A*B
If A was 2.1 and B was 2.0 the result stored in C would be 4.2.
Declare the string variable, a variable that stores text characters, with a variable declaration statement that specifies the variable type as a string. Use the general AS3 code syntax to declare a string variable:
var <variable name>: String
Where variable name is an arbitrary name for the string variable. As an example to declare a string variable, named B, as a string variable use the AS3 string variable declaration statement
var B: String
Assign (store) text in the string variable, named B, with the code
N= "this text will be displayed on the screen"
Note that the text to store in a string variable must be enclosed in a quotes.
Concatenate (connect together) two string variables stored in string variables AString and BString in a third string variable called CString with the code
CString = AString + BString
If AString was assigned the text "The students first name was" and the variable BString was the assigned the text " Mark" the value of CString would be "The student's first name was Mark." Note that a space was deliberately used in " Mark" so that when the strings are concatenated together there is a space between "was" and "Mark" in CString.