TRACE ACTIONS

VARIABLES

A variable is like a container for numbers or strings (text).

Variables: a means for the program to store data, such as a number or a string of text.  It’s like a box your put stuff in order to do things, carry things around, etc.  You declare or initialize a variable and then assign a value to it. You only declare it once.  However, you can change or assign a new value to it anytime. 

You let Flash know by using “var” then the name of the variable and its type separated by a colon.  A single “=” assigns a value to it. 

Here we are creating and declaring the values (what they contain) of the
following variables-

Variables must not contain spaces or weird characters.
Best to keep them short and descriptive.
You can use caps or underscores though, like this example- thisVariable or this_var.

var myFirst:String="hello world! Today I am";
Notice the syntax of ActionScript, each line ends with a semicolon
var mySecond:Number=1;

trace(myFirst+" "+mySecond); // This prints to the output panel in runtime.

Here are examples-
var myNumb:Number = 2000.987; // a number
var myNumb:int = -5; // a whole number
var myNumb:uint = 1500; // a non-negative whole number
var myText:String = “Hello crazy!!”; // a string or text as it were, always in quotes
var buttonPressed:Boolean = true; // value of either true or false, never in quotes
var myObject:Object = new Object(); // a generic object you create
var mySound:Sound = new Sound(); // a object from a Flash class of objects