Assigning Behaviors

   

You incorporate a behavior into your movie by dragging it from the Library palette. Depending on the behavior, you can drop it on a sprite in the Score or on the Stage ( Figure 14.2 ) or on a frame in the script channel of the Score ( Figure 14.3 ). You can assign multiple behaviors to a single sprite, but only one to a frame.

Figure 14.2. A behavior dragged to a sprite channel.

graphics/14fig02.gif

Figure 14.3. A behavior dragged to a frame in the script channel.

graphics/14fig03.gif

Certain behaviors can only be applied to sprites , and others can only be applied to frames . To find out which are which, you can use the Library palette's built-in "cheat sheet": If you hold the mouse pointer over a behavior's icon in the Library palette, a description of the behavior pops up, including a brief tip on how to use it ( Figure 14.4 ).

Figure 14.4. Hold the mouse pointer over a behavior icon in the Library palette to display a description of the behavior.

graphics/14fig04.gif

For most behaviors, a Parameters dialog box appears when you drop the behavior on a sprite or frame. That dialog box allows you to choose settings that determine when the behavior will be triggered and how it will execute.

After you assign a built-in behavior to a sprite or frame, that behavior goes into the Cast window ( Figure 14.5 ), where you're free to modify it. You can't modify the original behaviors stored in the Library palette.

Figure 14.5. When you assign a behavior to a sprite or frame, the assigned behavior goes into the Cast window, like any other cast member.

graphics/14fig05.jpg

When you play the movie, any behavior assigned to a frame is triggered automatically when the playhead enters the frame. Some sprite behaviorsnotably those in the Animation > Automatic categoryalso are triggered automatically, either when the movie begins to play or when the sprite first appears on the Stage. Most sprite behaviors, however, are triggered by a particular event, such as a mouse click. The Parameters dialog box allows you to specify the characteristics of the event that will trigger the behavior.

There are well over 100 behaviors in the Library palettetoo many to describe individually in this chapter. (See the sidebar, "What's in the Library?" for an overview.) You're encouraged to look at them, read their pop-up descriptions, and most importantly, experiment with them. (It's only software; you can't break anything.)

What's in the Library?

The Library palette contains seven categories of behaviors. Here's a summary of what's in each category.

3D

These behaviors are used to animate and add interactivity to 3D objects. For more information, see Chapter 18, "Shockwave 3D."

Accessibility

These behaviors help make Director movies accessible to people with visual, hearing, or motor impairments. For more information, see Chapter 20, "Accessibility."

Animation

This category contains three groups of behaviors that may be assigned to sprites. The Automatic behaviors make sprites change in various ways (such as moving randomly or changing color ) without any intervention from the user . The Interactive behaviors make sprites respond to the user's actionsfor example, by making a sprite follow the mouse pointer or allowing a sprite to be "tossed" across the Stage. The Sprite Transitions behaviors create effects similar to scene transitions (see "Using Scene Transitions" in Chapter 5).

Controls

These behaviors allow you to create user-interface elements such as menus and several kinds of buttons .

Internet

This category contains two types of behaviors intended especially for Shockwave movies. The Forms behaviors enable you to create forms that can submit data to CGI scripts on a Web server. The Streaming behaviors, which allow you to configure a movie for effective streaming, will be explained in Chapter 17, "Making Movies for the Web."

Media

The three subcategories here Flash, QuickTime , and Sound contain behaviors that help you create control buttons for sprites of those three types.

Navigation

This category contains behaviors that can be assigned to frames. They control the action of the playhead in various waysfor example, making the playhead jump to a specific frame or loop between two frames.

Paintbox

This set of behaviors contains all the tools you need to create an interactive paint window on the Stage so that users can create their own images.

Text

These behaviors allow you to process and format text in a variety of waysfor example, as a scrolling ticker tape or a disguised password. There are also behaviors here that automatically create a timer and a calendar.

To open the Library palette:

  • Choose Window > Library Palette.

To assign a behavior from the Library palette to a sprite or frame:

  1. Open the Library palette.

  2. In the Library palette, choose a categoryand, if necessary, a subcategory from the Library List pop-up menu ( Figure 14.6 ).

    Figure 14.6. Choose a category of behaviors from the Library List pop-up menu.

    graphics/14fig06.jpg

  3. Drag a behavior from the Library palette to a sprite in the Score or on the Stage, or to a frame in the script channel of the Score.

    Director lets you know where it's OK to drop the behavior by displaying black rectangles around "legal" areas as you drag. If the behavior is meant to be dropped on a frame, only frames will display the black rectangle; if the behavior is meant to be dropped on a sprite, only sprites will display the black rectangle.

    When you drag over illegal areas, the mouse pointer becomes a "no" symbol ( Figure 14.7 ).

    Figure 14.7. When you drag a behavior over areas where it can't be dropped, the mouse pointer becomes a "no" symbol (different for Windows and Mac).

    graphics/14fig07.gif

  4. Drop the behavior on the desired sprite or frame.

  5. If a Parameters dialog box appears, provide the information requested to tailor how the behavior works.

    For example, if you drop the Fade In/Out behavior, you'll be asked to specify the kinds of settings shown in Figure 14.8 .

    Figure 14.8. Choose settings for the behaviorin this case, parameters for the Fade In/Out behavior.

    graphics/14fig08.gif

  6. If necessary, click OK to close the dialog box.

    Director assigns the behavior to the sprite or frame, and also places a copy of the behavior in the Cast window.

graphics/tick.gif Tips

  • If you drag the same behavior from the Library palette more than once per movie, additional copies of that behavior are added to the cast. To avoid cluttering the Cast window, drag a behavior from the Library only the first time you use it in a movie. Thereafter, drag it from the Cast window instead.

  • If you intend to use a particular behavior in your movie but you're not ready to use it yet, you can drag it from the Library palette to the Cast window. Later, you can drag it from the Cast window to a sprite or frame.


To assign a behavior from the cast to a sprite or frame:

  1. Drag a behavior from the Cast window to a sprite in the Score or on the Stage, or to a frame in the script channel of the Score.

  2. Drop the behavior on the desired sprite or frame.

  3. If a Parameters dialog box appears, make the required settings.

    Each time you reuse a behavior, you're prompted for a new set of parameters. The parameters you set for one frame or sprite are not carried over when you apply the behavior to another frame or sprite.

  4. If necessary, click OK to close the dialog box.

    Director assigns the behavior to the sprite or frame. The contents of the Cast window remain unchanged.

   


Macromedia Director MX for Windows and Macintosh. Visual QuickStart Guide
Macromedia Director MX for Windows and Macintosh. Visual QuickStart Guide
ISBN: 1847193439
EAN: N/A
Year: 2003
Pages: 139

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net