Articles Archive
Articles Search
Director Wiki


October 16, 1997
by Pat McClellan

Dear Multimedia Handyman
I want to set up my projector so that when a user hits command-Q (or control-Q on Windows), a credits screen shows before it quits. I have several Director movies in the program and the user might quit from any of them. What should I do?

Delores in Des Moines

Dear Delores

This will require a three-step process and a few simple lingo commands. For starters, we'll need to disable the normal quit commands so that command-Q, command-period, and command-W don't cause the projector to quit. (On the Windows platform, it's the control key instead of command.) To do this, you need to set "the exitLock" to TRUE. Take a look in your Lingo Dictionary for a full description. Add this command to the startMovie script of your first movie:

set the exitLock to TRUE

With step one completed, there's no way for the users to quit the program. So now we need to give them a way to quit -- but via your credits. We'll set it up so that command-Q takes them to the credits... and then the credits will automatically quit when finished.

For step two, you should make a separate movie with your credits in it; we'll call it credits.dir. Add a script to the last frame of credits.dir that says:

on exitFrame

Step three of the process is to set up the keyDownScript which will take the user to credits.dir. Check the Lingo Dictionary for a good explanation of the keyDownScript property. Here's how to use it for this situation. In the startMovie script of your first movie, add this line:

set the keyDownScript = "checkExit"

Now, whenever ANY key is pressed, a handler called checkExit will be run. I just made up the name "checkExit", you can call it anything (one word). Now, let's tell the movie what we mean by "checkExit". We'll be using a couple of if-then statements and a few Lingo terms that you should know: the commandDown, the controlDown, and the key.

on checkExit
    if the commandDown OR the controlDown then
        if the key = "q" then
            go to movie "credits"
        end if
    end if
end checkExit

First, we checked to see if the user is holding down the command or control key. If they are, then we say are they also pressing the Q key? If that's a yes too, then the program goes to your credits movie (which quits after displaying your credits). Note that if the command or control key is NOT pressed down, then it never bothers to check anything else.

If you want command-W or command-period to also work, just change the key test to this:

if the key = "q" or the key = "w" ¬
    or the key = "." then

Good luck with your program.

Patrick McClellan is Director Online's co-founder. Pat is Vice President, Managing Director for Jack Morton Worldwide, a global experiential marketing company. He is responsible for the San Francisco office, which helps major technology clients to develop marketing communications programs to reach enterprise and consumer audiences.

Copyright 1997-2019, Director Online. Article content copyright by respective authors.