Screen.currentFocusedScreen

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

myScreen.currentFocusedScreen

Description

Static property (read-only); returns a reference to the "leafmost" Screen object that contains the global current focus. Leafmost refers to the screen that is furthest away from the root screen in the screen hierarchy. The focus may be on the screen itself, or on a movie clip, text object, or component inside that screen. This property defaults to null if there is no current focus.

For example, assume you have a runtime screen hierarchy that looks like this:

presentation
    screen1
        subscreen1_1
            mymovieclip
                myUIButton

    screen2
        subscreen1_2

If myUIButton has focus, the leafmost screen containing the focus is subscreen1_1, which is what currentFocusedScreen would return. In this case, presentation, screen1, and subscreen1_1 all contain the focus but the one that is "closest" (in the screen hierarchy) to the leaves of the tree (that is, farthest away from the root) is subscreen1_1.

Example

The following example displays the name of the currently focused screen in the Output panel.

var currentFocus:mx.screens.Screen = mx.screens.Screen.currentFocusedScreen;
trace("Current screen is: " + currentFocus._name);