Link to home
Start Free TrialLog in
Avatar of elepil
elepil

asked on

Flex 3 Theoretical question about how to cleanup your popup with PopUpManager

I know that when an instance of an object has an event listener attached to it and the event listener is not removed, this object will continue to exist in memory and will never go through garbage collection. I am now wondering how this applies to popups generated by PopUpManager.createPopUp().

I feel uncomfortable with PopUpManager not having the ability to allow me to reuse the same popup instance. Instead, each time you invoke createPopUp, it creates a new instance of the popup. So if I had added an event listener to the popup, I'm guessing all these instances of my popup will accumulate in memory.

This normally isn't an issue because I could remove the event listener in the CloseEvent of the popup. But my current application involves a popup that is NOT supposed to disappear until I get the results from the server. This result is determined in a DIFFERENT class, and hence, I find myself having to pass a reference of the popup to that other class just so I could remove the event listener and then invoke removePopUp().

But does anyone know for sure if removePopUp not only removes the popup off the DisplayList, but also removes all event listeners attached to the popup?
ASKER CERTIFIED SOLUTION
Avatar of ChristoferDutz
ChristoferDutz
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of elepil
elepil

ASKER

That works. Thanks!