• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The Library Palette

We're going to write a little Lingo in this chapter, but before we do, let's see what we can accomplish with behaviors that have already been written—behaviors provided by Director in the Behavior Library Palette. We'll begin by learning to transfer elements from one movie to another. Then we'll work on a new movie. Finally, we'll take what we have learned and apply it to the Rolling.dir movie we created in the last chapter.

Copying a Cast member

Let's see how easy it is to transfer elements from one Director movie to another. We are going to get a Cast member (the eight ball) from the Rolling.dir movie and add it to our new movie. Even though it would be easy enough to re-create the eight ball, sometimes you'll want to copy large parts of a movie or a number of intricate Cast members.

  1. Open the Rolling.dir movie you created in the previous chapter.

  2. Select and copy (Control-C Windows; Command-C Macintosh) the eight ball Cast member (the bitmap, not the film loop).

  3. From the File menu, select New and then Movie.

  4. Select slot 1 in the new Cast and paste (Control-V Windows; Command-V Macintosh) the eight ball bitmap.

  5. Save the movie as FollowTheMouse.dir.

Remember that although you can copy elements from movies (like the ones supplied on the CD that accompanies this book) that have the source intact, you will not be able to copy individual elements of movies that have been made into projectors or Shockwave movies.


We copied the Cast member using only a single instance of Director. If you have a lot of elements, including Score elements, that you want to copy, this process can get pretty tiresome: open movie, copy; open second movie, paste; open first movie, copy; and so on. One of the handier capabilities added to Director some time ago is the ability to have more than one instance of Director running at the same time. If you're building a movie that has elements in common with another of your movies, you can have both open at the same time and copy elements from one to the other.


The number of formats in which a Director file can be saved can be a little confusing, so let's clarify some terminology. A movie is the raw master data file that can be opened by anyone with a copy of Director. A protected movie has the same functionality, but no one can "get under the hood" and tinker with the elements of the production. A projector runs by itself, whereas a Shockwave movie can be run only within the context of a Web browser such as Netscape Navigator. These last two types can't be modified either, which is why you always want to keep a copy of the original movie. Finally, there are supporting files such as Xtras and external Casts, which aren't movies but can be vital to your productions.

Adding a behavior

Before we add a behavior, let's add our eight ball to the Score:

  1. From the File menu, select Preferences and then Sprite. In the Sprite Preferences dialog box, ensure that Span Duration is set to 1; then click OK.

  2. Drag the eight ball from the Cast to the center of the Stage.

  3. Use the Control Panel to make sure that looping is turned off.

Because of the Span Duration preference we set for sprites, the eight ball sprite takes up only one frame in the Score. If we run the movie now, the movie is over almost before we can get the cursor off the Play button. We're going to try building the movie in a single frame, so we need to keep the movie in frame 1 while still letting things happen.

  1. From the Window menu, select Library Palette.

The Library Palette appears. In the upper left is the Library List button, which provides access to the various categories into which the library is divided. For now, we want the Navigation behaviors.

  1. Click the Library List button to display the list of categories; then choose Navigation.

Choose your categories:

Use the Library List button to select from the behavior categories.

Figure .

Each behavior is illustrated and, by default, has a name next to it. If you place the cursor over any of the behaviors, a Tooltip appears containing an explanation of the behavior and, sometimes, additional information. As you can see, the Navigation behaviors mainly have to do with going somewhere in the movie or playing something. If we place the cursor over the Hold on Current Frame behavior, for example, we learn that it is a frame behavior and that it keeps the playback head in the current frame.

Tooltip time:

If you place the cursor over a behavior button, a Tooltip serves up behavior information.

Figure .

As we can see, Hold on Current Frame is a frame behavior, so we know to apply it to a frame in the behavior channel rather than to a sprite segment.

  1. Drag the Hold on Current Frame behavior from the Library Palette to the behavior channel at frame 1.

Note that the behavior shows up in several places: in the behavior channel, in the Cast (with its own distinctive picon), and in the Behavior List pop-up menu of the Score. Play the movie now; you should discover that the movie does, in fact, keep playing while the playback head remains in frame 1. Congratulations! You've just added a behavior to your movie without having to write a single line of Lingo.

Hold on there:

The Hold on Current Frame behavior appears in several places after you drag it to the behavior channel.

Figure .

Interactive behaviors

Although the behavior you added is useful, it hardly seems interactive. So now let's play around a bit with our sprite and see if we can give the user something to do. This time we'll drag a behavior onto the eight ball sprite.

  1. Use the Library List button on the Library Palette to select Animation and then Interactive.

  2. Find the Draggable behavior and drag it onto the eight ball sprite in the Score.

This time we need to make a decision about whether or not the sprite can be dragged all the way off the Stage. This is known as setting a parameter. To make our lives easy, the behavior displays a dialog box in which we can answer the question (or set the parameter). We want the sprite to stay on the Stage.

  1. Make sure the Constrain to Stage check box is checked; then click OK.

Set a parameter:

To ensure that the sprite cannot be dragged off the stage, check this check box.

Figure .

As you can see in the Cast window, another behavior is added to the Cast. Now go ahead and give the movie a try. While it's playing, click the eight ball and drag it around the Stage window. You can move it anywhere on the Stage, right up to the edge. Not bad for a simple click-and-drag operation!

Want to try another? Let's make the sprite rotate so that one side always faces the mouse cursor. This action is much more complicated from a programming standpoint, but with behaviors it's just as easy to implement.

  1. Find Turn Towards Mouse in the same group of interactive behaviors.

The behaviors are listed in alphabetic order; if you don't see the one you want, you can use the small arrow at the bottom of the window to scroll to it (or you can resize the window).

  1. Drag the Turn Towards Mouse behavior onto the sprite.


Here are a couple of handy facts about behaviors: You can attach more than one to a sprite, and you can arrange the order in which they are called. If one behavior is dependent on another, you can make sure that the correct one gets called first (we'll discuss linked behaviors more fully later in this book). You can attach only one behavior to a frame, however,

  1. For Turn, choose Away from the Mouse and Always. Click OK.

In the Parameters dialog box that appears, we can set three parameters. In this case, the third parameter doesn't matter, since there is no "otherwise" to Always.

Go ahead and play with the movie. You'll see that the eight ball turns when you move the mouse around and that you can still click and drag the eight ball. Both behaviors are working on this single sprite. Now that's interactivity!

Inspecting the Behavior Inspector

I happen to like the way the eight ball follows the mouse when the behavior is set to turn away from the mouse—it makes the 8 look like it's more or less following the cursor. But maybe you don't feel the same way about it; maybe you want the sprite to turn only when the mouse button is down. Wouldn't it be nice if there was an easy way to get back to the Parameters dialog box so you could make changes of this sort? Director has it covered, as we'll see.

But first, take a look at the Sprite Toolbar in the Score window. With the eight ball sprite selected, the eight ball picon appears in the upper-left corner of the Score. Just below that are the Behavior Inspector button and Behavior pop-up menu. Clicking the Behavior Inspector button will open the Behavior Inspector. The Behavior pop-up menu displays <Multiple> because we have attached more than one behavior to our sprite.

Inspector quick:

Click the Behavior Inspector button to display the Behavior Inspector.

Figure .

  1. With the eight ball sprite selected, click the Behavior Inspector button.

  2. If the windows of the Behavior Inspector don't look like the following picture, use the small triangular buttons on the left edge of the inspector to expand the windows.

Behavior inspection:

Behaviors are listed in the order in which they execute.

Figure .

The upper window of the Behavior Inspector lists the two behaviors attached to the eight ball sprite. The two side-by-side windows in the middle list the events that occur and the actions that are taken for each event. The window at the bottom of the Behavior Inspector contains an extended, scrollable description of the behavior; if you want to view the description of a behavior, this is where you go to find it.

  1. Select the Turn Towards Mouse behavior in the upper window and then click the Parameters button.

A Parameters dialog box appears. You can now set the parameters to whatever values you would like to try.


Some of the information about a sprite's behaviors is also available through the Property Inspector. Select the sprite and open the PI. The Behavior tab shows the information and always provides access to the parameter settings.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint