Web Design Resources & Tutorials to help you design the best website!
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()" resize="onResize()"> <mx:Script> <![CDATA[ import mx.containers.TitleWindow; import mx.managers.PopUpManager; private var popup:TitleWindow; /** * @private * when creationComplete fires it calls this function, we create the popup window * and center it using the PopUpManager static method of centerPopUp */ public function onCreationComplete():void { popup=TitleWindow(PopUpManager.createPopUp(this,TitleWindow,true)); PopUpManager.centerPopUp(popup); popup.width=200; popup.height=200; } /** * @private * AnyTime the window is being resized, what we do is we check the value of popup * if it is null that means the window has not been created (happens when program first loads), if it * got created then we use the PopUpManager to center it again */ private function onResize():void { if(popup) PopUpManager.centerPopUp(popup); } ]]> </mx:Script> </mx:WindowedApplication>

1 Response to Using the PopUpManager Class in Flex to Always Center PopUpWindow on Resize
Detlef
March 22nd, 2010 at 10:43 am
Hi,
I’m using a Flex’ PopupManager for opening a Dialog This works fine. I get a x (cross) in the right upper area of the window to close it and an Ok button for accept some changes. How can I assign the Enter key to the Ok button?
With best wishes,
Detlef