Using the PopUpManager Class in Flex to Always Center PopUpWindow on Resize

26 May
2008
Delicious
<?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>
Incoming Search Terms :popupmanager center , flex popupmanager center , flex popupmanager , popupmanager flex , flex popupmanager example , popupmanager flex 4 , flex popupmanager resize , flex popup resize , flex popup center , flex center popup window Incoming Search Terms :popupmanager center , flex popupmanager center , flex popupmanager , popupmanager flex , flex popupmanager example , popupmanager flex 4 , flex popupmanager resize , flex popup resize , flex popup center , flex center popup window

Share this story with a friend !
Join SherifAbdou's Rss Feed Stumble This Article! Add this to your Delicious Bookmarks! Digg this story ! Add this story to Reddit ! Tweet This Brush


1 Response to Using the PopUpManager Class in Flex to Always Center PopUpWindow on Resize

Avatar

DetlefNo Gravatar

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

Comment Form