I'm developing flex 4 application. On application complete I set a focus on tree component. But at the end focus left from tree. During debug I found out that main application has subscribed to FlexEvent.HIDE througn it's focus manager (FocusManager.as (line 159)):
container.addEventListener(FlexEvent.HIDE, childHideHandler, true);
And during any hide event dispatched from any child childHideHandler is called.
Here is it' code:
private function childHideHandler(event:Event):void
var target:DisplayObject = DisplayObject(event.target);
// trace("FocusManager focusInHandler in = " + this._form.systemManager.loaderInfo.url);
// trace("FM " + this + " focusInHandler " + target);
if (lastFocus && !isEnabledAndVisible(DisplayObject(lastFocus)))
DisplayObject(form).stage.focus = null;
lastFocus = null;
As you can see it resets lastFocus to null if it or it's parents are invisible or disabled. I can't undestand why you hide focus during any hide event dispatched from component which is not related to focused component?
This is a known bug. http://bugs.adobe.com/jira/browse/SDK-26273
If you have a simple test case, please post it or add it to the bug. We're
still looking for a good test simple test case.
A workaround would be to capture the HIDE event and