One of the things that I don't like about the Flex Popup's is that despite it being a "view", I can not declare it within mxml. I have to create a separate class for the popup component and then use the PopUpManager API to display it and remove it. Wouldn't be so nice if I could just declare the component to opened up, within my mxml and I could easily pass/get data from the component using bindings etc.
It is especially useful when creating Skinnable components as I can declare some component as a SkinPart and in the skin declare it to be opened up in a popup.
As I was looking to do something like that, I came across another Flex component - PopUpAnchor.
This is a very useful component which can be used to position a popup control. What this control doesn't do, is to open the popup in modal and centered manner. So I decided to create my own PopUpUIComponent component by stripping this PopUpAnchor of all the positioning code and use it only to open centered/ modal popups.
I quickly hatched a sample application which allows user to input text and then the text is passed onto the popup using bindings. The application can be seen below.
It is especially useful when creating Skinnable components as I can declare some component as a SkinPart and in the skin declare it to be opened up in a popup.
As I was looking to do something like that, I came across another Flex component - PopUpAnchor.
This is a very useful component which can be used to position a popup control. What this control doesn't do, is to open the popup in modal and centered manner. So I decided to create my own PopUpUIComponent component by stripping this PopUpAnchor of all the positioning code and use it only to open centered/ modal popups.
I quickly hatched a sample application which allows user to input text and then the text is passed onto the popup using bindings. The application can be seen below.
The opening and the closing of the popup is controlled by displayPopup var (same as in PopUpAnchor).
It is not the most perfect component but it does make things easier for me to use popups in mxml skins.Of course, there are some good alternatives out there if you are using frameworks like Cairngorm which has a nice popup library.
Hope it helps!
Download the source code
No comments:
Post a Comment