Best Practices and Coding Conventions for ActionScript 2.0

Adobe Flash designers and developers must write code and structure applications in a way that is intuitive and beneficial to themselves as well as to the other people who are working on the same project. This is particularly important in FLA files with lots of assets, or long code files. When you follow best practices and coding conventions, everyone on the design and development team can understand the file structure and ActionScript code and can work more efficiently. This document helps formalize the Flash development and coding process.

Because it is common for more than one designer or developer to work on a single Flash project, teams benefit when everyone follows a standard set of guidelines for using Flash, organizing FLA files, and writing ActionScript 2.0 code. The sections in this chapter outline the best practices for writing ActionScript, and some sections of Using Flash cover best practices when using the Flash authoring tool.

The following guidelines encourage consistency for people learning how to use Flash and write ActionScript code. Adopt best practices at all times, whether you are a designer or developer, or working alone or as part of a team.

Consistent techniques and the following guidelines help people learning Flash, or people working effectively in team environments. Consistent methods help you remember how you structured your document when you work by yourself, particularly if you have not worked on the FLA file recently.

These are only a few of the reasons to learn and follow best practices. You are bound to discover many more when you read these best practices and develop your own good habits. Consider the following topics as a guideline when you are working with Flash; you might choose to follow some or all of the recommendations. You can also modify the recommendations to suit the way you work. Many of the guidelines in this chapter help you develop a consistent way of working with Flash and writing ActionScript code.

This chapter covers the following subjects on coding conventions and best practices:

Naming conventions
Using comments in your code
ActionScript coding conventions
ActionScript and Flash Player optimization
Formatting ActionScript syntax

Flash CS3