Lingo Dictionary > A-C > commandDown |  |

commandDown

Syntax

    the commandDown

Description

Function; determines whether the Control key (Windows) or the Command key (Macintosh) is being pressed (`TRUE`) or not (`FALSE`).

You can use `commandDown` together with the element`the key` to determine when the Control or Command key is pressed in combination with another key. This lets you create handlers that are executed when the user presses specified Control or Command key combinations.

Control or Command key equivalents for Director's authoring menus take precedence while the movie is playing, unless you have installed custom Lingo menus or are playing a projector version of the movie.

For a movie playing back with the Director player for Java, this function returns `TRUE` only if a second key is pressed simultaneously with the Control or Command key. If the Control or Command key is pressed by itself, `commandDown` returns `FALSE`. This is because the browser receives the keys before the movie and thus responds to and intercepts any key combinations that are also browser keyboard shortcuts. For example, if the user presses Control+R or Command+R, the browser reloads the current page; the movie never receives the key combination.

For a demonstration of modifier keys in Lingo, see the sample movie "Keyboard Lingo" in Director Help.

Example

These statements pause a projector whenever the user presses Control+ or Command+A. By setting the `keyDownScript` property to `doCommandKey`, the `on prepareMovie` handler makes the `doCommandKey` handler the first event handler executed when a key is pressed. The `doCommandKey` handler checks whether the Control+A or Command+A keys are pressed at the same time and pauses the movie if they are.

    on prepareMovie
    	the keyDownScript = "doCommandKey"
    end
    on doCommandKey
    	if (the commandDown) and (the key = "a") then go to the frame
    end

See also

`controlDown`, `key()`, `keyCode()`, `optionDown`, `shiftDown`