• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 5. Adding Interactivity > Creating Navigation Scripts

Creating Navigation Scripts

In this task, you create simple Lingo scripts that use the markers you just inserted in the score. Instead of using the behavior channel to write a Lingo script, you'll attach scripts directly to the Credits button and Quit button cast members.

Select cast member 4 (ButtonCr) in the Cast window; then click the Script button.

Figure .

A Script window opens that looks like the one you used to enter a script in the behavior channel. However, there is a difference. This Script window has a different default handler. The on mouseUp and end statements are the default statements for scripts created for cast members. In the next step, you will supply the instruction that should be followed once the mouse is clicked and released, for that is what on mouseUp means.

Figure .

In the Script window, type go to frame "Credits" below on mouseUp exactly as shown here in bold:

on mouseUp
  go to frame "Credits" 

This instruction tells Director to find a frame with a marker labeled Credits. The label you gave the marker in frame 135 matches exactly. The marker label serves as a name of the frame in the movie. When you want to use a script to navigate to a frame where you've inserted a marker, you must include the quotation marks and spell the marker's label exactly as it appears in the marker channel.

Close the Script window.

Now you have a script attached to the Credits button cast member that will allow users to view the Credits screen when they click the Credits button. Next you will create a script to return users to the Menu screen after the Credits screen is displayed.


You can press Enter on the numeric keypad to close the Script window.

Double-click frame 139 in the behavior channel to open a Script window.

This is the last frame of the Credits screen. When the playback head arrives in this frame, you want the playback head to return to the Menu screen. Moving the playback head back to the Menu screen completes the last step of interactive branching: returning the playback head to the frame where the branching was initiated.

Type go to frame "Menu" below on exitFrame me exactly as shown here in bold. Then close the Script window.

on exitFrame me
  go to frame "Menu" 

Remember that earlier you created a marker called Menu. Now you're using Lingo to find that marker and branch to it. After the Credits screen is displayed for 2 seconds, as specified by the tempo setting in the same frame, the playback head will branch to the Menu marker, and the Menu screen will reappear.

Note that there's a big difference between the expression go to the frame— which basically means stay in the current frame—and the expression go to frame "marker label"— which requires you to specify a marker label within the quotation marks for the playback head to branch to. In Lingo, one word can make a big difference. The marker label must also be spelled within the script's quotation marks exactly as it appears in the marker channel, or Director won't be able to locate the frame.


Lingo is not case sensitive, so when you use it to refer to marker labels, you don't need to be concerned with capitalization, but spelling is important. If you spell a label one way and then refer to it later with a different spelling, Director will not be able to locate the marker and will display an error message.

Now two frames in the behavior channel have scripts assigned to them. If you move the cursor over them, the data tips display the cast member numbers of the scripts. Scripts you enter in the behavior channel are assigned as individual cast members in the Cast window.

Figure .

Scripts you add to cast members don't appear as individual scripts in the Cast window. Instead, a script icon appears in the thumbnail image of the cast in the Cast window.

Figure .

Save your work.

Rewind and play the movie. When you get to the Menu screen, click the Credits button.

The Credits screen should be displayed for 2 seconds, and then the Menu screen should reappear. Why does the Menu screen appear again? That's right; the script in frame 139 of the behavior channel instructs Director to move the playback head to the frame labeled Menu.


If you let the movie run on the Menu screen for a while, you probably noticed that the background music stopped playing. If you look at the score, you will notice that the Bgsound sprite in sound channel 1 extends only to frame 130. You can change the endpoint of that sprite to 139 so that it includes all the frames used by the movie. The background music will now play when the Menu screen and Credits screen are displayed.

Now the only script left to write is a script for the Quit button on the Menu screen. There is no destination screen for this button since users will quit the presentation when they click this button. This means that the script statement you'll write for this button is different from the go to statements you've written so far. Like the script for the Credits button, you'll add this script to the Quit button cast member.

Stop the movie. Then select cast member 5 (ButtonQt) in the Cast window and click the Script button to open the Script window. Type halt below on mouseUp, as shown here in bold:

on mouseUp


When you are authoring in Director, the halt command stops the running movie and returns you to authoring. When the movie is played as a stand-alone program outside of Director, the halt command terminates the program. There is a similar command in Lingo called quit, but that terminates Director as well as the running movie. Using the halt command is generally preferable since you don't need to restart Director every time you test your movie.

Close the Script window and save your work.

Rewind and play the movie.

The movie pauses at the Menu screen.

Click Credits.

The Credits screen is displayed for 4 seconds, and then the Menu screen is displayed again.

When you're ready to quit, click Quit.

After you click Quit, the movie closes and returns you to Director for more authoring.



Not a subscriber?

Start A Free Trial

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