My AS3 application basically does the following (pseudo code from main application class) 3 or 4 times by adding custom objects to stage:
_movieClipClassVariable = new MyCustomSpriteSubclass();
_movieClipClassVariable.addEventListener(MyEvents.READY, function(event:Event):void {
_hideLoading();
mcHolder.addChild(_movieClipClassVariable);
});
_movieClipClassVariable.addEventListener(MouseEvent.CLICK, myClickHandler);
private function coverClickHandler(event:Event):void
{
...
}
What is the right way to allow Garbage Collector to recycle _movieClipClassVariable
after it is not necessary? Assign null
to it? Remove all listeners? Use weak reference for listeners?
Thanks in advance!