Director Help

Creating and modifying behaviors

Without any scripting or programming experience, you can use the Behavior inspector to create and modify behaviors to perform basic actions. To create behaviors with more complex structures, you must understand scripting in Lingo or JavaScript syntax.

Using the Behavior inspector is a good way to learn Lingo or JavaScript syntax. Examine the scripts created by the Behavior inspector to see how basic functions are assembled. To view the associated script, select any behavior and click the Script button.

Most behaviors detect an event and then perform one or more actions in response. The Behavior inspector lists the most common events and actions used in behaviors.

For experienced programmers, the Behavior inspector also provides a shortcut for writing simple scripts.

Note: To always edit behaviors in the Script window instead of the Behavior inspector, select Edit > Preferences > Editors. In the Editors Preferences dialog box, select Behaviors from the list and then click Edit. In the Select Editor box, select Script Window. (If you are using a Mac OS X operating system, select the Director menu, instead of the Edit menu, to access Preferences.)

  1. Do one of the following:
    • To create a new behavior, click the Behaviors menu, select New Behavior, and enter a name for the new behavior.

      The behavior appears in the currently selected Cast window in the first empty position. Select an empty cast position first if you want the behavior to appear in a different place.

    • To modify a behavior, select it in the Behavior inspector.
  2. Click the arrow in the lower left of the Behavior inspector to expand the editing pane.

    A. Click here to expand the editing pane

    The editing pane shows the events and actions in the current behavior. If you are creating a new behavior, no events or actions appear.

    • To add a new event or action group to the behavior, select an event from the Events pop-up menu and then select actions for the event from the Actions menu. Choose as many actions as you need for a single event.
    • To change an existing event or action group, select an event from the list and then add or remove actions in the Actions list.
    • To delete an event or action group, select the event and press Delete.
    • To change the sequence of actions in an event or action group, select an event from the Events list, select an action from the Actions list, and then click the up and down arrows above the Actions list to change the order of actions.
    • To lock the current selection so nothing changes in the Behavior inspector when new sprites are selected, click the Lock Selection button in the lower left of the expanded Behavior inspector.

If you are familiar with Lingo or JavaScript syntax, you can edit a behavior’s script directly.