MovieClip.onKillFocus ( ) Event Handler

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
MovieClip.onKillFocus ( ) Event Handler Flash 6

handler executed when the clip loses keyboard focus
mc.onKillFocus(newFocus)

Arguments

newFocus

The TextField, MovieClip, or Button object that now has focus, or null if no object has received focus.

Description

The onKillFocus( ) event handler executes when mc loses keyboard focus. A movie clip can be keyboard-focused only under one or more of the following circumstances:

  • It defines at least one button event handler (onPress( ), onRollOver( ), etc.).

  • Its tabEnabled property is true, in which case it can be focused by the Tab key.

  • Its focusEnabled property is true, in which case it can be focused by Selection.setFocus( ).

A movie clip loses focus in the same manner as a button, as described under Button.onKillFocus( ). The onKillFocus( ) handler can be used to remove a highlight state on a focused interface element. In simple cases, this can also be done with the special _up and _over frame labels. See MovieClip.focusEnabled and MovieClip._focusrect.

To capture all focus events centrally, rather than for a single instance, use Selection.onSetFocus( ).

Usage

Take note that onKillFocus( ) cannot be used in a Flash 5-style onClipEvent( ) block.

The onKillFocus( ) handler does not work with main movie timelines (e.g., _root, _level1, _level2) because main timelines cannot receive input focus.

See Also

Button.onKillFocus( ), MovieClip.focusEnabled, MovieClip.tabEnabled, MovieClip._focusrect, Selection.setFocus( ), Selection.onSetFocus( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net