The FocusManager manages focus from the "component level". In Flex, a UITextField in a component is the only way to allow keyboard entry of text. To the Flash Player or AIR, that UITextField has focus. However, from the FocusManager's perspective the component that parents the UITextField has focus. Thus there is a distinction between component-level focus and player-level focus. Application developers generally only have to deal with component-level focus while component developers must understand player-level focus.
The Flash player doesn't see a Flex component as something that can receive focus. Flex's
FocusManager remedies this, and does all the heavy lifting for you. However, if you're working with a
FocusEvent, you soon realize that the event's
relatedObject properties are not what you might be expecting.
FocusEvent is dispatched natively by the Flash player (it's not a Flex event). So the objects retrieved by the
relatedObject properties of the
FocusEvent are with respect to Flash player level focus (they will be some lower level objects, not Flex components).
FocusManager in conjunction with
FocusManager has two useful methods that you should be using in conjunction with
getNextFocusManagerComponent(backward:Boolean = false):IFocusManagerComponent
findFocusManagerComponent() to translate the low level object in the event's
target property into the Flex component that contains the low level object.
getNextFocusManagerComponent() to determine where the focus is going next. Don't use
relatedObject property for this. This method accepts a Boolean argument to specify whether the focus is moving forwards/backwards. BTW, there is a bug in Flex 3.3 where this argument is ignored, fixed in Flex 4 and 3.5.