Jul 7, 2011 6:55 AM
Scroller null focusManager exception
-
Like (0)
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
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
Thanks Haim, that's perfect.
Copyright © 2011 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).