where and how are you adding the event listener?
The listener gets added right after the PopUpManager.addPopUp is called.
The handling function is inside the parent of the pop up window, the window just has a form and fires an even after data is sent.
1 person found this helpful
Removing the eventListeners on a popup window is necessary I believe.
In your event handling function, you can remove the event listener by event.target.removeEventListener(..., ...). It doesn't matter that your component is handle by the popUpManager, you'll still have a reference to it.
In main app:
var win:myClass = PopUpManager.createPopUp(this, myClass, true) as myClass;
private function myHandler(evt:Event):void
In custom myClass:
private function handleSomething(evt:Event):void
var ev:Event = new Event("myEvent");
PopUpManager.removePopUp(this as IFlexDisplayObject);
Does this help?
I know how to do it, I was just wondering if I should do it or if the removePopUp will leave it to the Garbage Collector...
So I take it I am responsbile for cleaning the `mess` up?
All the articles I found on this subject warn to remove the event listeners, so I think they're right.
On the other hand, I couldn't find an adobe article stating this.
So, until further notice, I guess it's safest to remove them. I found out that I forgot to do that in one of my projects too
A listener simply creates a reference from the dispatcher to the listener.
In the code below, there is now a reference from "win" to the class that
owns "myHandler" which is the document, so adding that listener will not
cause a leak.
There is no code below, but I understand what you are saying! Thanks!