Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
facade.registerMediator(new DetailsPopupMediaotr(???));
package util.popup{ import flash.display.DisplayObject; import flash.display.Sprite; import mx.core.Application; import mx.core.IFlexDisplayObject; import mx.managers.PopUpManager; import org.puremvc.as3.multicore.patterns.facade.Facade; /** * Used to handle popup opening controling registering and unregistering mediators * * @author */ public class PopManager extends PopUpManager { private static var popupList:Array=new Array(); /** * Opens a popup window. Window component is crated and mediator is assigned to it. * Targeted for PureMVC multicore so method requires moduleId to be passed */ public static function openPopUpWindow(ComponentClass:Class, MediatorClass:Class, moduleUid:String, modal:Boolean=true, parent:DisplayObject=null):IFlexDisplayObject { if (parent == null) { parent=Application.application as DisplayObject; } var window:IFlexDisplayObject=PopUpManager.createPopUp(parent, ComponentClass, modal); var obj:Facade=Facade.getInstance(moduleUid)as Facade; obj.registerMediator(new MediatorClass(window)); PopUpManager.centerPopUp(window); return window; } /** * Removes PopUp window and unregisteres associated mediator */ public static function closePopUpWindow(window:IFlexDisplayObject, mediatorName:String, moduleUid:String):void { PopUpManager.removePopUp(window); Facade.getInstance(moduleUid).removeMediator(mediatorName); } /** * * Tries to retrieve popup window from the list of popups already opened. If there is no window opened with * provided mediator name associated with it, a new one is created and displayed. */ public static function retrievePopUp(ComponentClass:Class, MediatorClass:Class, mediatorName:String, moduleUid:String, modal:Boolean=true):IFlexDisplayObject { if (popupList[mediatorName]) { PopUpManager.addPopUp(popupList[mediatorName]as IFlexDisplayObject, Application.application as Sprite, modal); PopUpManager.bringToFront(popupList[mediatorName]); } else { popupList[mediatorName]=openPopUpWindow(ComponentClass, MediatorClass, moduleUid, modal) } return popupList[mediatorName]; } /** * Removes popup from display list. The actual popup object still exists in the list and can be retrieved */ public static function hidePopUp(window:IFlexDisplayObject, mediatorName:String):void { PopUpManager.removePopUp(window); } /** * Removes the popup completle. Also unregisters mediator. */ public static function destroyPopUp(window:IFlexDisplayObject, mediatorName:String, moduleUid:String):void { closePopUpWindow(window, mediatorName, moduleUid); if (popupList[mediatorName]) { popupList[mediatorName]=null; } } }}