- What is ActionScript
- About choosing between ActionScript 1.0 and ActionScript 2.0
- Understanding ActionScript and Flash Player
About choosing between ActionScript 1.0 and ActionScript 2.0
When you start a new document or application in Flash, you must decide how to organize its associated files. You might use classes in some projects, such as when you are building applications or complex FLA files, but not all documents use classes. For example, many short examples in the documentation do not use classes. Using classes to store functionality is not the easiest or best solution for small applications or simple FLA files. It is often more efficient to put ActionScript inside the document. In this case, try to put all your code on the Timeline on as few frames as possible, and avoid placing code on or in instances (such as buttons or movie clips) in a FLA file.
When you build a small project, it is often more work and effort to use classes or external code files to organize ActionScript instead of adding ActionScript within the FLA file. Sometimes it is easier to keep all the ActionScript code within the FLA file, rather than placing it within a class that you import. This does not mean that you should necessarily use ActionScript 1.0. You might decide to put your code inside the FLA file by using ActionScript 2.0 with its strict data typing and its new methods and properties. ActionScript 2.0 also offers a syntax that follows standards in other programming languages. This makes the language easier and more valuable to learn. For example, you will feel familiar with ActionScript if you have encountered another language that’s based on the same structure and syntax standards. Or, you can apply this knowledge to other languages you learn in the future. ActionScript 2.0 lets you use an object-oriented approach to developing applications by using an additional set of language elements, which can be advantageous to your application development.
In some cases, you cannot choose which version of ActionScript to use. If you are building a SWF file that targets an old version of Flash Player, such as a mobile device application, you must use ActionScript 1.0, which is compatible with Flash Player for a number of devices.
Remember, regardless of the version of ActionScript, you should follow good practices. Many of these practices, such as remaining consistent with case sensitivity, using code completion, enhancing readability, avoiding keywords for instance names, and keeping a consistent naming convention, apply to both versions.
If you plan to update your application in future versions of Flash, or make it larger and more complex, you should use ActionScript 2.0 and classes, to make it easier to update and modify your application.