Alex, I have implemented the code to destroy event listeners in all of my widgets, as well as the calling class. The calling class is called from the root as a module. Before unloading the module I do the following to try and remove all event listeners;
private function clearModuleEvents(mdlModule:ModuleLoader):void { trace('Starting clearModuleEvents') for(var idx:int = mdlModule.numChildren - 1; idx >= 0; idx--) { trace('idx=' + idx + 'isContainer(objChild)=' +isContainer(objChild) + 'isContainer(mdlModule.getChildAt(idx))=' + isContainer(mdlModule.getChildAt(idx))); var objChild:DisplayObject = mdlModule.getChildAt(idx); trace('flash.utils.getQualifiedClassName(objChild)=' + flash.utils.getQualifiedClassName(objChild)); var childContainer:DisplayObjectContainer = objChild as DisplayObjectContainer; clearChildEvents(childContainer); if ("clearEvents" in objChild) { var fncClearEvents:Function = objChild["clearEvents"]; if (objChild.hasOwnProperty('id')) trace('Clearing Events in==>>' + objChild['id']); fncClearEvents(); fncClearEvents = null; } if ("dataProvider" in objChild)objChild["dataProvider"] = null; if ("selectedIndex" in objChild)objChild["selectedIndex"] = -1; if ("selectedItem" in objChild)objChild["selectedItem"] = null; if ("value" in objChild)objChild["value"] = null; } objChild = null; trace('Finished clearModuleEvents') } private function clearChildEvents(dpsContainer:DisplayObjectContainer):void { for(var idx:int = dpsContainer.numChildren - 1; idx >= 0; idx--) { var objChild:DisplayObject = dpsContainer.getChildAt(idx); if (isContainer(objChild)) { var childContainer:DisplayObjectContainer = objChild as DisplayObjectContainer; clearChildEvents(childContainer); } if ("killMe" in objChild) { var fncKillMe:Function = objChild["killMe"]; if (objChild.hasOwnProperty('id')) trace('Killing Events in==>>' + objChild['id']); fncKillMe(); fncKillMe = null; } else if ("clearEvents" in objChild) { var fncClearEvents:Function = objChild["clearEvents"]; if (objChild.hasOwnProperty('id')) trace('Clearing Events in==>>' + objChild['id']); fncClearEvents(); fncClearEvents = null; } if ("dataProvider" in objChild)objChild["dataProvider"] = null; if ("selectedIndex" in objChild)objChild["selectedIndex"] = -1; if ("selectedItem" in objChild)objChild["selectedItem"] = null; // if ("value" in objChild)objChild["value"] = null; objChild = null; } } -- Sent from: http://apache-flex-users.2333346.n4.nabble.com/