Skip navigation
kevin.gaffney
Currently Being Moderated

Scroller null focusManager exception

Jul 7, 2011 6:55 AM

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(resizeCo mponent);

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

  • Currently Being Moderated
    Community Member
    Jul 7, 2011 12:01 PM

    Kevin,

     

    The problem is that your popup doesn't implement the IFocusManagerContainer interface.

    Implementing IFocusManagerContainer allows the system to assign a FocusManager to the popup, and this error goes away.

     

    Regards,

    Haim Arazy

    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points