2 Replies Latest reply on Jul 7, 2011 2:35 PM by kevin.gaffney

    Scroller null focusManager exception

    kevin.gaffney

      Currently working on a project that needs to take a component & pop it out of it's parent to the top level app. I am using a spark textAera. Initially when the textArea is "unpopped out" the textAera works fine. However, when it is popped out and a user then focuses in on the textArea a null object reference is thrown from the Scroller class focusInHandler method.

       

      Currently to remove and pop out the component the code I am using is:

       

      IVisualElementContainer(resizeComponent.parent).removeElement(resizeComponent);

      FlexGlobals.topLevelApplication.systemManager.addChild(resizeComponent);

       

      where resizeComponent is the component I want to pop out.

       

      Exception occurs when focusing in, Scroller.as:

        

      override protected function focusInHandler(event:FocusEvent):void

          {

              super.focusInHandler(event);

             

              // When we gain focus, make sure the focused element is visible

              if (viewport && ensureElementIsVisibleForSoftKeyboard)

              {

                  var elt:IVisualElement = focusManager.getFocus() as IVisualElement; //null object excpetion thrown here

                  lastFocusedElement = elt;

              }

          }

       

      What am I doing wrong?

       

      Thanks,

      Kevin