MACROMEDIA FLASH 8-USING FLASH Use Manual page 340

Using flash
Table of Contents

Advertisement

Because code can be placed in many different locations, it complicates matters as to where you
should put your code. Therefore, you must consider the type of application you're writing and
what it requires in the way of ActionScript. As with behaviors, you should use ActionScript
consistently in screen-based applications.
The difference between screens and behaviors is that the ActionScript that behaviors add is
much more complex than most of the behaviors available for a regular FLA file. Screens are
based on complex ActionScript, so some of the code used for transitions and changing slides
might be difficult to write yourself.
You might use either behaviors or ActionScript that attaches directly to screens, combined
with either a Timeline or an external ActionScript file. Even if you decentralize your code this
way, have code put on screens and an external ActionScript file, you should still avoid
attaching code directly to movie clip or button instances that are placed on individual screens.
This ActionScript is still hard to locate in a FLA file, debug, and edit.
Even if you attach code directly to a screen, it is more acceptable and easier to use than in
regular FLA files for the following reasons:
The code that attaches to screens when you use behaviors often doesn't interact with other
ActionScript you might write—you can place behaviors there and you might not have to
worry about editing the code further, which is ideal.
The code placed directly on screens is easy to locate and view the hierarchy of, because of
the Screen Outline pane. Therefore, it is easy to quickly locate and select all of the objects
that you might have attached ActionScript to.
If you use behaviors placed on screens (or other instances), remember to document the
location on Frame 1 of the main Timeline. This is particularly important if you also place
ActionScript on the Timeline. The following code is an example of the comment you might
want to add to your FLA file:
/*
On Frame 1 of main Timeline.
ActionScript is placed on individual screens and directly on instances in
addition to the code on the Timeline (frame 1 of root screen).
...
*/
Placing code in the FLA file
Using behaviors on screens while placing ActionScript on the main Timeline makes a screen-
based FLA file less complex and easier to work with than a regular FLA document. Behavior
code is sometimes added to instances where it might take a long time to create because of its
complexity. The convenience of using behaviors might vastly outweigh any drawbacks if the
behaviors you add to a screens document are quite complex to write yourself.
340
Working with Screens (Flash Professional Only)

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents