You can always just move the Alert yourself...
private function popUpAlert():void{ var myMenu:Menu = new Menu(); var popUpButton:PopUpButton = new PopUpButton(); addChild(popUpButton); popUpButton.x = this.width / 2; popUpButton.y = this.height / 2; var dp:Object = [{label: "Alpha"}, {label: "Beta"}, {label: "Gamma"}]; myMenu.dataProvider = dp; myMenu.selectedIndex = 0; myMenu.addEventListener("itemClick", itemClickHandler); popUpButton.popUp = myMenu; } private function itemClickHandler(evt:MenuEvent):void{ var alert:Alert = Alert.show("Are you sure? \n\n There is no Un-Do", 'Delete *All Completed* ?', Alert.YES| Alert.NO, null, responseToDeleteAllCompletedHandler, null, Alert.NO); alert.move (parentDocument.width / 2 - alert.width/2, parentDocument.height /2 - alert.height / 2); } private function responseToDeleteAllCompletedHandler(evt:CloseEvent):void{ if(evt.detail == Alert.YES) trace("Yes"); else trace("No"); --- In flexcoders@yahoogroups.com, "steveb805" <quantumcheese...@...> wrote: > > Thanks TH. That's weird, there must be something else in my code, then as > I'm still not able to get it to the center. > > My hierarchy in my main.mxml is > mx.Application > mainPanel > myPopupButton > > I tried > this.parent as Sprite > and > mainPanel.parent as Sprite > > And a couple of other things.. > > TH, > I'm not waiting on a solution from you specifically, because you were just > explaining the facts about the popup specifically, and the need to cast that > parameter. > > Maybe someone else will see this who has run into this specific situation. > > Steve > > > > --- In flexcoders@yahoogroups.com, "turbo_vb" <TimHoff@> wrote: > > > > Hi Steve, > > Popups exist outside the normal DisplayList, so you can work around it > > by setting the Alert's parent like this: > > Alert.show("your text", "your title", 4, parentApplication as Sprite); > > -TH > > --- In flexcoders@yahoogroups.com, "steveb805" > > wrote: > > > > > > Seems like until now, my Alert boxes appear in the center ok. > > > > > > However, now that I am using a PopUpButton, and in response to one of > > the menu item clicks I am calling Alert.show(), the popup box is stuck > > at the upper left. > > > > > > My popupbutton handler: > > > > > > private function itemClickHandler(event:MenuEvent):void { > > > switch (event.index) { > > > case 0: > > > ... > > > case 1: > > > Alert.show( "Are you sure? \n\n There is no Un-Do", > > > 'Delete *All Completed* ?', > > > Alert.YES| Alert.NO, > > > null, > > > responseToDeleteAllCompletedHandler, > > > null, > > > Alert.NO); > > > default: > > > } > > > } > > > > > > > > > For the parent parameter - which is supposed to be a Sprite - I tried > > this.parent, hoping this would fix it, but complained of type mismatch. > > > > > > Weird that the Alert works fine when calling it in response to normal > > buttons on my main panel, but all of a sudden the Alert is confused > > about the parent when calling the Alert.show in response to a *popup* > > type button. > > > > > > ( maybe I should download an updated Flex sdk? it's been a couple of > > months) > > > > > > Any advice would help > > > tx, > > > Steve > > > > > >