The listener won't cause a memory leak. The window now has a reference to the handler function not the other way around.
Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: [email protected] [mailto:[email protected]] On Behalf Of steveb805 Sent: Monday, November 30, 2009 2:50 PM To: [email protected] Subject: [flexcoders] calling removeListener on a popup I have a mxml component based on TitleWindow that's used for a Popup. Nothing new there - big yawn goin your way. I also have an addEventListener called on the object (so I can dispatch a custom event): ----------- win = EditTaskBox(PopUpManager.createPopUp(this, EditTaskBox, true)); win.taskText.setFocus(); . . win.addEventListener("taskInputText", newTaskDialogBoxHandler); ---------- So obviously, you want to call removeListener when you're done with the dialog, so I call removeEventListener in newTaskDialogBoxHandler(), in main.mxml, after I use the information from the custom event. win.removeEventListener("taskInputText", newTaskDialogBoxHandler); However, in the case of *cancelling* the dialog box, do I need to dispatch an event in this case as well, from within the component.? In my customer TitleWindow component, called EditTaskBox.mxml, for the closeButton handler, I call PopUpManager.removePopUp(this); It's not like you can do: "removeEventListener(..) here, since you're in a static component,right? Looks like I need to just create a meta declaration for a custom event, but obviously don't need a custom Event class or anything. Just verifying this. Thanks Steve

