Adobe FLASH CS3 PRO User Manual page 474

Hide thumbs Also See for FLASH CS3 PRO:
Table of Contents

Advertisement

Comparing timeline code with object code
To avoid problems that decentralized ActionScript 2.0 code creates, carefully plan a document that uses behaviors.
Many developers do not place ActionScript on symbol instances, and instead place their code on the Timeline
(timeline code) or in classes. Because behaviors add code to many locations in a FLA file, your ActionScript is not
centralized and can be difficult to locate. When code is not centralized, it is difficult to understand interactions
between the snippets of code, and it is impossible to write elegant code. Decentralized code can potentially lead to
problems debugging code or editing files.
If you use behaviors, try the following features to facilitate working with behaviors and decentralized ActionScript:
Makes your timeline code or code on individual objects easy to find and edit in the Actions panel.
Script Navigator
Lets you search for strings and replace them in a FLA file.
Find And Replace
Lets you pin multiple scripts from various objects and work with them simultaneously in the Actions
Script Pinning
panel. This method works best with the Script navigator.
Lets you view and organize the contents of a FLA file, and select elements (including scripts) for
Movie Explorer
further modification.
When to use behaviors
The main difference between a FLA file with behaviors and a FLA file without behaviors is the workflow you must
use for editing the project. If you use behaviors, you must select each instance on the Stage, or select the Stage, and
open the Actions or Behaviors panel to make modifications. If you write your own ActionScript and put all your code
on the main Timeline, you only have to make your changes on the Timeline.
If you have a FLA file with symbols, you can select one of the instances on the Stage, and use the Add menu on the
Behaviors panel to add a behavior to that instance. The behavior you select automatically adds code that attaches to
the instance, using "object code" such as the
behaviors to a frame using the Behaviors panel.
Decide how to structure your FLA file. Examine how and where to use behaviors and ActionScript in your FLA file.
Consider the following questions:
• What code do the behaviors contain?
• Do you have to modify the behavior code? If so, by how much? To modify the behavior code to any extent, do not
use behaviors. You usually cannot edit behaviors by using the Behaviors panel if you make modifications to the
ActionScript. To significantly edit the behaviors in the Actions panel, it is usually easier to write all of the Action-
Script yourself in a centralized location.
• What other ActionScript do you need, and does other ActionScript have to interact with the behavior code?
Debugging and modifications are easier to make from a central location. For example, if code on a timeline
interacts with behaviors placed on objects, avoid behaviors.
• How many behaviors do you have to use, and where do you plan to put them in the FLA file? If your behaviors are
all placed on a timeline, they might work well in your document. Or, your workflow might not be affected if you
use only a small number of behaviors. However, if you use many behaviors on a lot of object instances, writing
your own code on the Timeline or in external ActionScript files might be more efficient.
Remember, ActionScript 3.0 does not support behaviors.
handler. You can also select a frame on a timeline, and add different
on()
FLASH CS3
468
User Guide

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash cs3 professional

Table of Contents