I guess I'm surprised that your clickhandlers fires more than once. The mx:ButtonBar shouldn't be leaking because of the clickHandler. That looks like a reference within the module, not from the outside in.
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 Derrick Anderson Sent: Monday, December 14, 2009 12:41 PM To: [email protected] Subject: [flexcoders] removing event listeners for safe module reloading Hi, I'm having what seems to be an all too common problem with modules. I have split my app into 3 separate modules, and listeners created in 1 instance of a module get duplicated the second time a module loads. Events defined in mxml are a big problem <mx:ButtonBar id="listButtons" dataProvider="{ListData}" itemClick="clickHandler(event)" /> the second time a module is loaded that contains this buttonbar that clickHandler function will fire twice, and 3 times for the 3rd load. so i attempted to remove listeners, and only add listeners if they are not already there so: private function init():void { if(!listButtons.hasEventListener(ItemClickEvent.ITEM_CLICK)) listButtons.addEventListener(ItemClickEvent.ITEM_CLICK,clickHandler,false,0,true); } private function removeListeners():void { listButtons.removeEventListener(ItemClickEvent.ITEM_CLICK,clickHandler,false); } the 'removeListeners' function is called from the removedFromStage event on the class, but that listener will still get added each time. it does not help that profiler does not work on this machine, but what is the proper way to remove all event listeners from a module so it can safely reload?? thanks, d.

