Tuesday, December 21, 2010

Popup Scopes and easy way to close all open Popups

While creating popup we can define the scope of the popup (i.e where the popup list is maintained ) by defining detail parameter while creating or adding a popup. The PopUpManagerChildList class defines constants for the detail property for the PopUpManager addPopUp() and createPopUp() methods.

systemManager isntance has a "popUpChildren" variable which maintains list of all popups created in PopupManagerChildList.POPUP scope. Thus we can easily remove all the popups created in this scope using the following snippet:

while (systemManager.popUpChildren.numChildren > 0){
PopUpManager.removePopUp(IFlexDisplayObject(systemManager.popUpChildren.getChildAt(0)));
}


While creating popup use the following signature:

        PopUpManager.createPopUp(this, class ,modalValue,PopUpManagerChildList.POPUP) ;
or
        PopUpManager.addPopUp(popupInstance,this,false,PopUpManagerChildList.POPUP);

No comments:

Post a Comment