Types of scripts

A Director movie can contain four types of scripts: behaviors, movie scripts, parent scripts, and scripts attached to cast members. Behaviors, movie scripts, and parent scripts all appear as independent cast members in the Cast window. A script attached to a cast member is associated with that cast member in the Cast window and does not appear independently.

  • Behaviors are scripts that are attached to sprites or frames in the Score, and are referred to as sprite behaviors or frame behaviors. The Cast window thumbnail for each behavior contains a behavior icon in the lower-right corner.

    When used in the Director Scripting Reference, the term behavior refers to any script that you attach to a sprite or a frame. This differs from the behaviors that come in the Director Library Palette. For more information on these behaviors, which are built into Director, see the Using Director topics in the Director Help Panel.

    All behaviors that have been added to a cast library appear in the Behavior inspector’s Behavior pop-up menu. Other types of scripts do not appear there.

    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 contain handlers that are available globally, or on a movie level. Event handlers in a movie script can be called from other scripts in the movie as the movie plays.

    A movie script icon appears in the lower-right corner of the movie script’s Cast window thumbnail.

    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.

  • Parent scripts are special scripts that contain Lingo that is used to create child objects. You can use parent scripts to generate script objects that behave and respond similarly yet can still operate independently of each other. A parent script icon appears in the lower-right corner of the Cast window thumbnail.

    For information on using parent scripts and child objects, see Object-oriented programming with Lingo syntax.

    JavaScript syntax does not use parent scripts or child objects; it uses regular JavaScript syntax-style object-oriented programming techniques. For information on object-oriented programming in JavaScript syntax, see Object-oriented programming with JavaScript syntax

  • Flash® member components placed on the stage (Flash sprites) that are invisible can be accessed only by using the Member object. Using a Sprite object for a Flash sprite with an invisible property will result in an error.

  • 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 behaviors, movie scripts, and parent scripts, cast member scripts do not appear in the Cast window. However, 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.