How screens interact with actionscript – Adobe Flash Professional CS3 User Manual

Page 385

Advertising
background image

FLASH CS3

User Guide

379

9

Click OK.

10

In the Behaviors panel, in the Event column, click in the row for the new behavior and select an event from the

list. This action specifies the event that triggers the behavior—for example, the mouse pointer moving over the
screen.

Screen instance names, class names, and registration points

The screen name automatically generates the instance name and class name of the screen. You need these identifying
labels when you manipulate screens with ActionScript in various ways. To adjust how the screen behaves, change a
screen’s registration point. You can work with these features in the following ways:

The instance name is a unique name assigned to a screen, used when you target the screen in ActionScript. Change
the instance name in the Property inspector. The instance name is identical to the screen name in the Screen
Outline pane and the linkage identifier for the screen. If you update the instance name, the screen name and the
linkage identifier also update.

Note: Symbol instances, including movie clips, buttons, and graphics, also have instance names.

The class name identifies the ActionScript class to which the screen is assigned. By default, a slide screen is
assigned to the

mx.screens

.

Slide

class, and a form screen is assigned to the

mx.screens

.

Form

class. To modify

the methods and properties that are available for the screen, assign the screen to a different class. For more infor-
mation on ActionScript classes, see Classes in Learning ActionScript 2.0 in Adobe Flash.

The Property inspector indicates the registration point in the x and y coordinate fields and in the registration grid.
You might want to move the registration point for greater control in manipulating screen content. For example, to
create a spinning shape in the center of a screen, reposition the screen registration point at the center of the screen
and rotate the screen around its registration point.

See also

“Using symbols, instances, and library assets” on page 208

How screens interact with ActionScript

Screens are similar to nested movie clips in the way that they interact with ActionScript. However, some differences
exist.

Use the following guidelines for ActionScript with screens:

When you select a screen in the Screen Outline pane and add ActionScript, the script is added directly to the
screen as an object action (much as ActionScript is added directly to a movie clip). Use object actions for simple
code (such as creating navigation between screens) and external ActionScript files for more complex code.

For best results, organize the document structure and finalize screen names before adding ActionScript. If you
rename a screen, the instance name is automatically changed, and you must update the instance names in any
ActionScript code you write.

To add a frame action to the Timeline for a screen, select the screen, open the Timeline (Window > Timeline), and
select the first frame in the Timeline. Use an external ActionScript file, rather than a frame action, for complex
code on a screen.

You cannot view or manipulate the main Timeline for a screen-based document. However, you can target the main
Timeline using

_root

in a target path.

Advertising