Flex PopUpManager: How can I detect the existence of a modal popup?
Solution 1
I think it depends on the way you are adding the popup, check the documentation :
http://livedocs.adobe.com/flex/3/langref/mx/managers/PopUpManager.html
create or add popup takes four parameters and fourth parameter is a child list
childList:String (default = null) — The child list in which to add the popup. One of PopUpManagerChildList.APPLICATION, PopUpManagerChildList.POPUP, or PopUpManagerChildList.PARENT (default).
So try adding all the popup's to a particular child-list and then play around with the size of the list.
Solution 2
In case you have no control on the popups that are created (i.e. you've got a library component that creates popups and the component has not been made by you so you cannot modify it) you can still find all the popups in the application without adding them to a specific list. If interested in a different approach, you can check my blog post at http://www.devahead.com/blog/2009/12/getting-all-the-popups-in-a-flex-application/
Glenn
Developer of StrategyBlocks.com application(s). Javascript / HTML / CSS / SVG (jQuery, D3.js, Bootstrap, etc...) Flex & AS3 Flash Ruby / JRuby
Updated on June 04, 2022Comments
-
Glenn almost 2 years
My Flex 3 application has some modal dialogs displayed via the PopUpManager, but there are times when I'd like other view components to know there is popup displayed. The PopUpManager doesn't have any method for actually checking the existence of popups. Is there any other way to detect this in flash/flex without writing my own global manager?
(also systemManager.popUpChildren.numChildren == 0 even when there's a modal popup)
Cheers.
-
Glenn over 14 yearsI'll play with those and let you know. They're not very clear how to access the childlist.
-
Glenn over 14 yearsIt was the right idea, but I couldn't find documentation about what the childList option means, until I found this: blog.flexmonkeypatches.com/2007/10/04/flex-close-all-popups. POPUP setting attaches the popup to the systemManager.popUpChildren list.