I have a singleton event dispatcher.
I have a data panel that lives in a tabnavigator.
When the panel is removed from the tabnavigator I would like
it to stop listening and hopefully be gc'd.

upon init the panel adds its listener func.
CentralEventDispatcher.getInstance().addEventListener(MainController.EVENT_DATA_LOADED,dataLoadFunc);

I have a remove function triggered when the panel is removed from the
tabnavigator.

private function removeListener():void
{
        var ced:CentralEventDispatcher =  CentralEventDispatcher.getInstance();
        if(ced.hasEventListener(MainController.EVENT_DATA_LOADED))
        {
   
        ced.removeEventListener(MainController.EVENT_DATA_LOADED,dataLoadFunc);
        }
}




Reply via email to