Accessibility
Jen deHaan

Jen deHaan

Adobe
flashthusiast.com

Table of Contents

Created:
20 February 2006
User Level:
Beginner, Intermediate
Products:
Flash

ActionScript 2.0 Best Practices

ActionScript coding conventions are very important for Macromedia Flash designers and developers to ensure that code and applications are structured in a way that is intuitive and beneficial to themselves as well as other people working on the same project. This is particularly important with long code files. When you follow coding conventions, everyone on the design and development team can understand the code and can work more efficiently. This document helps formalize the ActionScript coding process.

The sections in this article outline best practices for writing ActionScript. Some sections of Flash Help (Help > Getting Started in Flash) or the Flash 8 LiveDocs are helpful as well: Learning ActionScript 2.0 in Flash and ActionScript 2.0 Language Reference.

Note: For information about using Flash 8 and organizing FLA files, see Flash 8 Best Practices. It complements this document.

The following guidelines encourage consistency for people learning how to 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:

  • When you work on ActionScript documents: Adopting consistent and efficient practices helps you speed up your workflow. Additionally, your code is often more portable within the framework of a larger project, and easier to reuse.
  • When you share AS files: Other people editing the document can quickly find and understand ActionScript and consistently modify the code.
  • When you work on applications: Multiple authors can work on an application with fewer conflicts and greater efficiency.
  • When you are learning or teaching ActionScript: Following coding conventions reduces the need to relearn particular methodologies. If students learning ActionScript practice consistent and better ways to structure code, they might learn the language more quickly and with less frustration.

Note: If you are still using Flash MX Professional 2004 and not Flash Professional 8, please see the previous version of this article.

Requirements

These guidelines relate to the following software:

Flash Professional 8

About the author

Jen deHaan was raised by wolves in the deep woods of the Canadian north. Later in life, Jen worked with Flash as a deseloper, then wrote about Flash for five versions, and then worked on stuff that didn't include much Flash. She came to her senses in 2007 by rejoining the fabled Flash team at Adobe as a QE, focusing on the good stuff—Motion (on timelines). Jen enjoys long walks in the rain pondering how many times she can use the word Flash in a bio, and admits that after numerous years in California she is no longer addicted to Tim Horton's coffee.