PopupManager.createPopupWindow

If you’re wondering how to pass parameters into a Flex popup window, as documented here or here, or how to set the initObj parameter.. it’s deprecated.

I was trying to figure out how to create a popup window and pass a parameter into it, and really I still don’t think I have, but the new official way to do this is to set properties of the popup window class after it’s been created. So for example:

var popup:MyPopup = PopUpManager.createPopUp( popupParent, MyPopup, true ) as MyPopup;
popup.someVariable = someValue;

I don’t see documented whether the popup’s initialize may have already run by the time you get to properties on it.

Also, the documentation (and various Google searches) implies that the way to center a popup is to create it and then call centerPopUp but that centers it once – it won’t stay centered as the window changes size. If you want it to stay centered as the browser or AIR app is resized, then bind the position of the popup to the application’s size:

<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
x="{(Application.application.width/2) - (this.width/2)}"
y="{(Application.application.height/2) - (this.height/2)}">

This keeps the popup centered.