464
Chapter 23: Best practices
Adobe® Flash® CS3 Professional contains features and capabilities that make it a flexible tool and allow more than
one way to do the same thing in Flash. Over time, the Flash community has developed preferred methods for accom-
plishing many common tasks.
Best practices encourage consistency when you work on Flash or ActionScript™ documents, share FLA or Action-
Script files, work on applications, and when you are learning or teaching Flash and ActionScript.
Structuring FLA files
Organizing timelines and the library
Frames and layers on a timeline show you where assets are placed and determine how your document works. How
a timeline and the library are set up and used affect the entire FLA file and its overall usability. The following guide-
lines help you author content efficiently, and let other authors who use your FLA documents have a greater under-
standing of how the document is structured.
•
Give each layer an intuitive layer name, and place related assets together in the same location. Avoid using the
default layer names (such as Layer 1, Layer 2).
Clearly describe the purpose or content of each layer or folder when you name them.
If applicable, place your layers that include ActionScript and a layer for frame labels at the top of the layer stack in
the timeline. For example, name the layer that contains your ActionScript actions.
•
Use layer folders to group and organize similar layers, to facilitate locating the layers that include code and labels.
•
Lock layers that you are not using or do not want to modify. Lock your ActionScript layer immediately so that
symbol instances or media assets are not placed on that layer.
•
Never put any instances or assets on a layer that includes ActionScript. Because this can potentially cause conflicts
between assets on the Stage and ActionScript that references them, keep all of your code on its own actions layer,
and lock it after you create it.
•
Use frame labels in a FLA file instead of using frame numbers in your ActionScript code if you reference frames
in your code. If those frames change later when you edit the timeline, and you use frame labels and move them on
the timeline, you do not have to change any references in your code.
•
Use library folders.
Use folders in the library to organize similar elements (such as symbols and media assets) in a FLA file. If you name
library folders consistently each time you create a file, it is easier to remember where you put assets. Commonly used
folder names are Buttons, MovieClips, Graphics, Assets, Components, and, sometimes, Classes.