1 Reply Latest reply on May 7, 2010 10:20 AM by Flex harUI

    flex 4 FocusManager childHideHandler misunderstanding

    andrey.gorbatov Level 1

      Hello.

      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?

      Thanks.