Director Tutorial

Using Scripts

Scripts are written directions that control events and actions in Director produced movies or software. Think of them as a movie screenplay or a script for a stage play. Scripts can add special effects, flexibility, and interactivity to your project. This is a sample script to your right.

Using scripts effectively requires planning your project.  With a goal in mind outline the events that are to occur in the project. Decide what types of scripts to use and how they should be structured, just as the director of a play blocks out the movements of the actors in each scene. 

Next collect the cast and then begin writing simple scripts. Make sure each section of a script works well before beginning another. Test it frequently.



 
 










 


 
Director scripts come in four varieties, behaviors (prewritten or ones you can write yourself), movie scripts, parent scripts, and scripts attached to cast members. Lingo is the scripting language for Director. 
 

The script icons to the right identify what type of script is atttached to a cast member.
 

 
Behavior Scripts 
Movie Scripts 
Parent Scripts 
Attached to Cast Members 
 

Cast member 35


 
Behaviors identify an event and then perform one or more actions in response to it.

There are two types of behavior scripts. The first are built-in or prewritten behaviors that are added to a sprite or frame. These are found in the Library Palette under Window in the menu bar. These are the easiest to use.
 


 
The name of the active category is listed in the field at the top. Interactive is the the active category in the example to the right.

Use the arrows to scroll up or down to view all the active category's behaviors. 

Clicking on the square icon to the left of the active category will display a list of all the categories.

A pop-up window describing  the behavior appears when the mouse stops on the behavior
icon.
 

 
To add a Behavior to a frame drag one of the pre-written behaviors from the Library Palette and drop it onto the frame in the score. 

In A Day at the Beach the prewritten behavior Go Loop was used to replay the dolphin scene.

Behaviors from the Library Palette are copied to an internal cast to keep from accidentally changing an original behavior.
 
 
 
 
 

 


 
A behavior is added to a Sprite in the same way. Drag the behavior onto the sprite either in the Score or on the Stage. 

For example the Jaws theme could be attached to the shark sprite.
 
 
 
 
 
 

 


 
The second type of behavior is a Lingo script written by you, the author. Your script can be attached to a sprite or frame.  The script on the right is used to link the two parts of the  movie A Day at the Beach.
Lingo scripts are executed from the first to the last statement, so it is important to place the statements in order, especially when a value or condition is necessary  for the execution of that statement. 
Remember, all behaviors identify an event and then perform one or more actions in response to it.
The Behavior Inspector is used to create and modify simple behaviors using Lingo scripts. 
 
 
 
 

To add a new behavior click the frame that you wish to attach the behavior to. Under the  Windows menu choose Inspectors/ Behavior.

Next click on the popup button, the plus sign (+), in the Behavior Inspector window. Type in the name of the new behavior, click OK, and then type in the lingo script.
 


Use the Behavior Inspector to modify scripts. To make changes in our looping segment discussed earlier, we can use the popup Event and Action menus.
 
 
 
 
 

The Behavior Inspector is also helpful in learning more complex Lingo scripts by studying the structure and syntax of the prewritten scripts.

 



 
More sophisticated types of Lingo scripts are Movie Scripts, Parent Scripts and Scripts Attached
to Cast Members. 
Parent Scripts provide the advantages of  object-oriented programming, and are used to create child objects that behave similarly to the parent script, but they can also behave independently. 

Scripts Attached to Cast Members are independent of the score. Whenever one of these cast members is assigned to a sprite, the script is always available.

Movie Scripts are cast members and control movies within a program. They respond to mouse clicks and key presses and control the starting and stopping of a movie.

When you have mastered using behaviors from the Library Palette and writing simple Lingo script   and are ready to create more complex action within your movie or program, Director Help and Macromedia Support Center can provide you with detailed information.