# Selection.onSetFocus

#### Availability

Flash Player 6.

#### Usage

    someListener.onSetFocus = function(oldFocus, newFocus){
    statements;
    }

#### Description

Listener; notified when the input focus changes. To use `onSetFocus`, you must create a listener object. You can then define a function for `onSetFocus` and use the `addListener` method to register the listener with the Selection object, as in the following:

    someListener = new Object();
    someListener.onSetFocus = function () { ... };
    Selection.addListener(someListener);

Listeners enable different pieces of code to cooperate because multiple listeners can receive notification about a single event.

#### See also

`Selection.addListener()`