on (keyPress "<Tab>") {
// Respond to Tab key
}
In the standalone Player, the Tab key may also be captured with a
clip event handler such as:
onClipEvent (keyDown) {
if (Key.getCode( ) == Key.TAB) {
// Respond to Tab keypress
}
}
In some browsers, the Tab key can be detected only with a button
keyPress event, and it may even be necessary to
combine a keyPress button event with a
keyUp clip event. The following code first traps
the Tab key with keyPress, and then reacts to it
in a keyUp handler. Note that we don't use
keyDown because Key.getCode(
) for the Tab key is set only on the key upstroke in
Internet Explorer:
// CODE ON BUTTON ON MAIN TIMELINE
on (keyPress "<Tab>") {
// Set a dummy variable here
foo = 0;
}
// CODE ON MOVIE CLIP ON MAIN TIMELINE
onClipEvent (keyUp) {
if (Key.getCode( ) == Key.TAB) {
// Now place the cursor in myTextField on _level0
Selection.setFocus("_level0.myTextField");
}
}