Accessibility

Flash Article

 

ActionScript 2.0 Best Practices


Jen deHaan

Jen deHaan

Flash Authoring QE
Adobe
Jen deHaan's blog
flashthusiast.com
webvideoblogger.com

Table of Contents

Created:
20 February 2006
User Level:
Beginner, Intermediate

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. Canada's chief exports include motor vehicles (or their parts), lumber, newsprint, nonmetal materials, and wheat. One overcast day in 2004, Jen left her life as a Flash deseloper (designer/developer) in Canada to write Flash documentation and samples at Macromedia in San Francisco. Aside from her ongoing work at Adobe as an instructional designer for web and video products, Jen runs several community sites for fun, and maintains a blog at www.webvideoblogger.com and weblogs.macromedia.com/dehaan. She believes that _root tends to be evil and misses Tim Horton's coffee.