-
Step 1
This tutorial assumes that know how to launch Flash and press F9 to get to the ActionScript development (coding) window. Do that now.
-
Step 2
To delcare a variable in ActionScript you start by telling ActionScript you are about to delcare a variable. That is done with the keyword "var".
-
Step 3
The nest step is to give your variable name. For our example we will use "myfirstvariable". So the code so far looks like:
var myfirstvariable -
Step 4
Now you need to give your variable a type, although not required, it is best practice to do so. A variable can be of type, string, boolean, or number to name a few. Here is what our code looks like now:
var myfirstvariable : Number;
The colon between the variable name and the type separates the two and the semicolo at the end lets the compiler know that is the end of the line.
If you wanted to give your variable an initial value you can do this on the same line by typing something similar the following:
var myfirstvariable : Number = 60;









