What is ActionScript? - Debugging changes
(Page 5 of 5 )
This section describes changes that improve your ability to debug your ActionScript programs.
Output window changed to Output panel You can now move and dock the Output panel in the same way as any other panel in Flash. It shows error messages (including some runtime errors) and lists of variables and objects
Improved error reporting at compile time In addition to providing more robust exception handling, ActionScript 2.0 provides several new compile-time errors.
Improved exception handling The Error class and the throw and try..catch..finally statements let you test and respond to runtime errors from within your script so that you can implement more robust exception handling.
Changes compared to ActionScript 1.0
The following are the major changes that you will find in ActionScript 2.0 when compared with 1.0.
Case Sensitivity: Case sensitivity is the new feature introduced in ActionScript 2.0, and whenever you publish your movie in Flash Player 7 or later it will be applied to your code. That means variable names that differ only in case (
depth and
Depth) are considered different from each other. This applies to keywords, class names, variables, method names, and so on.
This change also affects external variables loaded with LoadVars.load() or loadvariables().
Case-sensitivity is implemented in external scripts such as class files, scripts that you import using the #include command, and scripts that you write in your flash movie.
Strict Data Typing: This is another useful feature that allows you to type cast your variables to their appropriate data types, so that you can restrict variables to accept only specified data type values.
When creating a variable with ActionScript 2.0, use the following syntax not only to create the variable, but also to assign its data type at the same time:
var a:String = "Hello World";
The above line says that "a" is a variable of string data type. If you assign any other data type value to "a" (Example: a = 20) it throws a "Type mismatch" error when compiled. Strict data typing also applies to classes, functions to type cast function parameters, return types, and so forth. Example:
var my_array:Array = new Array(); var my_lv:LoadVars = new LoadVars(); function myFunction(name:String, age:Number):Void { }
It is recommended to type cast all variables, classes, functions, and so forth that you use in your script; it proves to be a good programming practice.
Conclusion
This introduction just tells you the basics and core features and changes in ActionScript 2.0 compared to ActionScript 1.0. However there are a lot more useful features and concepts available in ActionScript 2.0, using which you can create some wonderful flash based applications.
Here are some useful ActionScript resources over the Web for you to get started using ActionScript:
http://www.macromedia.com/devnet/mx/flash/actionscript.html
http://www.actionscript.com/
http://www.actionscripts.org/
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |