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:
where resizeComponent is the component I want to pop out.
Exception occurs when focusing in, Scroller.as:
override protected function focusInHandler(event:FocusEvent):void
// 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?
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.
Thanks Haim, that's perfect.