- - Variables & Data Types - -
Rules for naming variables:
-must be one word
-can only include alphanumeric characters, or $, or _
-should not start with a number
-should not already be a keyword or reserved for ActionScript
"...Flash must be told what you intend to store in each variable."
Example:
var variableName(colon)dataType;
or
var myVariable:int;
Data Type | Example | Description |
Number | 4.798 | Any number, including decimals |
int | -4 | Any integer or whole number |
uint | 1 | Unsigned integer or any non-negative whole number |
String | "hello" | Text or string of characters |
Boolean | true | True or False |
Array | [2, 9, 17] | More than one value in a single variable |
Object | myObject | "The basic structure of every ActionScript entity, but also a custom form that can be used to store multiple values as an alternative to Array." |