From the Adobe Docs:
Just call the centerPopUp
method in the CreationComplete
event of your TitleWindow.
private function handleCreationComplete():void {
// Center the TitleWindow container
// over the control that created it.
PopUpManager.centerPopUp(this);
}
If you're creating the popUp from within a method, you can also try:
public function openWindow(event:MouseEvent):void {
myPopUp = new TextArea();
myPopUp.width= 220;
myPopUp.height= 150;
myPopUp.text = "Hold down the Shift key, and " +
"click in the TextArea to close it.";
myPopUp.addEventListener(MouseEvent.CLICK, closeWindow);
PopUpManager.addPopUp(myPopUp, this, true);
PopUpManager.centerPopUp(myPopUp);
}
Edit: You can also try:
PopUpManager.centerPopUp(Application.application as DisplayObject);
or if the component is directly on your application's main stage
PopUpManager.centerPopUp(this.parent);
Second Edit: If you're using the PopUpManager.addPopUp
method to launch your popup, just change the 2nd argument from this
to this.parent
(or whatever component you like). The 2nd argument tells the PopUpManager
what your popup's parent is. Check out the Adobe Live Docs for more info.
PopUpManager.addPopUp(myPopUp, this.parent, true);