AS3 - how to remove children/subchildren and all associated event listeners from memory

Ok here’s my fix for my issues commented above.

When the nested swf is deleted.
Code on it’s timeline has a listener for a child clip on the timeline.
In this case “bear_mc”

stage.addEventListener(Event.ENTER_FRAME, moveBg, false, 0, true ); stage.addEventListener(Event.ENTER_FRAME, moveTracker, false, 0, true); bear_mc.addEventListener(Event.REMOVED_FROM_STAGE, deleteG);

All the listeners with the original top two causing the errors

then

function deleteG(evt:Event):void {
stage.removeEventListener(Event.ENTER_FRAME, moveBg);
stage.removeEventListener(Event.ENTER_FRAME, moveTracker);

}

This fixed my errors of NULL references being thrown in the parent.

Hope this helps