> var popup:Object ; > popup = PopUpManager.createPopUp( FlexGlobals.topLevelApplication as > DisplayObject, DeleteStudentConfirmation , true); > PopUpManager.centerPopUp(popup as mx.core.IFlexDisplayObject); > addEventListener("OKTODELETE", deleteThisRecords)
Did you try popup.addEventListener("OKTODELETE", deleteThisRecords); instead ? Frédéric THOMAS ---------------------------------------- > Subject: Events with itemRenders > From: smathe...@intralinks.com > To: users@flex.apache.org > Date: Sun, 28 Jun 2015 17:41:02 +0000 > > > Hi > > I have a grid with an itemRender, I want to centre the popup in the overall > frame, so i am using " FlexGlobals.topLevelApplication as DisplayObject" > > > this is snip on my code in the GridItemRender, > > > my problem is the addEventListener is not picking up the event from > "DeleteStudentConfirmation" popup > > > > > > <?xml version="1.0" encoding="utf-8"?> > <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" > xmlns:s="library://ns.adobe.com/flex/spark" > width="5"> > > > private function deleteAlert():void{ > > > // open the PopUp Window as a modal popup window > // and store it in a variable for later use > > > var popup:Object ; > popup = PopUpManager.createPopUp( FlexGlobals.topLevelApplication as > DisplayObject, DeleteStudentConfirmation , true); > PopUpManager.centerPopUp(popup as mx.core.IFlexDisplayObject); > addEventListener("OKTODELETE", deleteThisRecords) > } > > > > the popup > > > private function deleteClosewindows():void { > // PopUpManager.removePopUp(this); > > _ep = new Event("OKTODELETE", true); > dispatchEvent(_ep); > PopUpManager.removePopUp(this); > } > > Disclaimer: This electronic mail and any attachments are confidential and may > be privileged. If you are not the intended recipient, please notify the > sender immediately by replying to this email, and destroy all copies of this > email and any attachments. Thank you.