Using Director > Navigation and User Interaction > Checking keys with Lingo

 

Checking keys with Lingo

Lingo can detect the last key the user pressed.

To obtain the ANSI value of the last key that was pressed, use the key() function. See key().

To obtain the keyboard's numerical (or ASCII) value for the last key pressed, use the keyCode() function. See keyCode().

A common place for using key and keyCode is in an on keyDown handler. This instructs Lingo to check the value of key only when a key is actually pressed. For example, the following handler in a frame script sends the playback head to the next marker whenever the user presses Enter (Windows) or Return (Macintosh):

on keyDown
	if the key = RETURN then go to marker (1)
end