Add a Focus Loop to Adobe Flex PopUpManager

This took me a whole frigging day to figure out.

In a project I created a custom PopUp, nothing big, just a custom component from the Group Class which will have some text inputs and a few buttons.

The Documentation about the IFocusManager states that a pop up will get its own FocusManager and its own tab loop. After some tracing I found that my pop up and its child weren’t included in the FocusManager as focus objects. In fact, there was no FocusManager for my pop up at all. The reason for this is that when the PopUpMangerImpl is about to create and configure the pop up, it checks if the pop up is a IFocusManagerContainer so that focus can be added. Unfortunately my popup was a Group which does not implement the IFocusManagerContainer interface. Naturally no FocusManager would be created. If you want to use a Spark Group as your pop up, the solution is to create a new class that extends from Group and implements the IFocusManagerContainer. Then use this class as the container for the pop up.

OR As a quick and dirty fix, you can just make your group container a "Skinnable Container" which implements IFocusManagerContainer automatically. Teh trade off here is that you will have the overhead of skinnable container in your project. 

No comments:

Post a Comment