next up previous
Next: Messages and Events Up: Multimedia Programming:Scripting (Lingo) Previous: Lingo Lists

Types of Scripts

Director uses four types of scripts.

Behaviors
-- Behaviors are attached to sprites or frames in the Score. Behaviors assigned to sprites are sprite behaviors. Behaviors assigned to a frame's behavior channel are frame behaviors. Director includes a set of behaviors that are already written. Using Lingo, you can create additional behaviors for your specific needs. Behaviors are script cast members that appear in a Cast window. The Cast window thumbnail for each behavior contains a behavior icon in the lower-right corner.

Behavior Icon

All behaviors appear in the Sprite Inspector's Behavior pop-up menu. (Other types of scripts don't appear in the Behavior pop-up menu.) Attach behaviors to sprites or frames in two ways:

You can attach the same behavior to more than one location in the Score. When you edit a behavior, the edited version is applied everywhere the behavior is attached in the Score.

Movie scripts
Movie scripts are available to the entire movie, regardless of which frame the movie is in or which sprites the user is interacting with. When a movie plays in a window or as a linked movie, a movie script is available only to its own movie. In addition to responding to events such as key presses and mouse clicks, movie scripts can control what happens when a movie starts, stops, or pauses. Handlers in a movie script can be called from other scripts in the movie as the movie plays. Movie scripts are cast members that appear in a Cast window. A movie script icon appears in the lower-right corner of the movie script's Cast window thumbnail.

Movie script icon

Parent scripts
Parent scripts are special scripts that contain Lingo used to create child objects. Parent scripts are cast members that appear in a Cast window. A parent script icon appears in the lower-right corner of the Cast window thumbnail:

Parent script icon

Scripts attached to cast members
Scripts attached to cast members are attached directly to a cast member, independent of the Score. Whenever the cast member is assigned to a sprite, the cast member's script is available. Unlike movie scripts, parent scripts, and behaviors, cast member scripts don't appear in the Cast window. Open scripts attached to cast members by clicking Script in the cast member's Cast Member Properties dialog box or by selecting a cast member in the Cast window and then clicking the Script button. You can also open a cast member script from the Script window.

Script button

If Show Cast Member Script Icons is selected in the Cast Window Preferences dialog box, cast members that have a script attached display a small Script icon in the lower-left corner of their thumbnails in the Cast window.


next up previous
Next: Messages and Events Up: Multimedia Programming:Scripting (Lingo) Previous: Lingo Lists
Dave Marshall
10/4/2001