With the PopupManager it's possible to add/create/remove a new popup. But i can't find a way to get the top most popup without overriding this class (which something you want to do for a big Flex application).
So far I found this solution, which is more kinna of work around. So if any body has a better solution, i will be pretty much happy to read it.
Assuming the you call the addPopup/createPopup with the parameter PopUpManagerChildList.POPUP
, example :
PopUpManager.createPopUp(parent,MyPopupClass,true,PopUpManagerChildList.POPUP);
The this function will return the top most popup:
private function getTopMostPopup():void
{
var childList:IChildList = Application.application.systemManager.popUpChildren;
for (var i:int = childList.numChildren - 1; i > 0; i--)
{
var child:DisplayObject = childList.getChildAt( i );
if (child is Container)
return child;
}
return null;
}
Application.application.systemManager.popUpChildren
contains all the DisplayObject displayed with PopupManager. But many of the itemRenderers of your components could be in this list eventhough there are not visible in the screen. This is why my function get the last child inheriting from Container (your popup must inherit from Container).