ActionScript3:Migrating from ActionScript 2

Variable Naming ActionScript 3
ActionScript 3 requires that you now declare a variable type. With ActionScript 2 you could get away not using a  statement or even a type. The following list declares variables and some common types:


 * var myVarName:Int;
 * var myVarName:String;
 * var myVarName:MovieClip;
 * var myVarName:Number;
 * var myVarName:Sound;
 * var myVarName:StyleSheet;
 * var myVarName:URLLoader;
 * var myVarName:XML;

There are many more, the code hints in the Actions Frame will help when declaring the variable type and offer a large list of options. You can now store not only simple data types such a numbers and strings, but also complex data types such as sounds and objects. To use a class object you must create a new instance of the object and save it as a variable eg: