User Guide

keyboardFocusSprite 819
-- Lingo syntax
on prepareMovie
keyDownScript = "checkKey"
end
on checkKey
if (_key.key = "q") then _movie.go("Main Menu")
end if
end
// JavaScript syntax
function prepareMovie() {
keyDownScript = checkKey();
}
function checkKey() {
if (_key.key == "q") {
_movie.go("Main Menu");
}
}
This on keyDown handler checks whether the last key pressed is the z key and if it is, calls the on
addNumbers
handler:
-- Lingo syntax
on keyDown
if (_key.key = "z") then addNumbers
end
// JavaScript syntax
function keyDown() {
if (_key.key == "z") {
addNumbers();
}
}
See also
commandDown, Key
keyboardFocusSprite
Usage
-- Lingo syntax
_movie.keyboardFocusSprite
// JavaScript syntax
_movie.keyboardFocusSprite;
Description
Movie property; lets the user set the focus for keyboard input (without controlling the cursor’s
insertion point) on a particular text sprite currently on the screen. Read/write.
This is the equivalent to using the Tab key when the
autoTab property of the cast member
is selected.
Setting
keyboardFocusSprite to -1 returns keyboard focus control to the Score, and setting it to
0 disables keyboard entry into any editable sprite.