alright, so I’m familiar with removing children and nulling them to put them up for garbage collection.
my question regards a class that contains a bunch of variables. And whether removing it as a whole kills all the variables in the class. I just want to make sure that I’m managing resources properly.
Would I be wrong in adding an event listener to the video class, that would listen for removed_from_stage, and on removal it would null all the variables in the class? but then the question to me becomes, if the video object itself is being removed, and nulled, does it get nulled before it even has a chance to run the “removed from stage” function… or does it run it, and then it is nulled?
if i try to trace variables from in the video class from the main website after it’s been removed i can’t get any, so i assume they’re gone…
but yeah, any tips anyone has for garbage collecting variables, would be wonderful…
here’s some of the code just so you can see what i’m talking about…
this would be the on removed from stage function…
private function removed(e:Event):void{
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed, false);
tmrDisplay.stop();
tmrDisplay.removeEventListener(TimerEvent.TIMER_COMPLETE, updateDisplay);
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseReleased);
stage.removeEventListener(FullScreenEvent.FULL_SCREEN, onFullscreen);
mcVideoControls.btnPause.removeEventListener(MouseEvent.CLICK, pauseClicked);
mcVideoControls.btnPlay.removeEventListener(MouseEvent.CLICK, playClicked);
mcVideoControls.btnMute.removeEventListener(MouseEvent.CLICK, muteClicked);
mcVideoControls.btnUnmute.removeEventListener(MouseEvent.CLICK, unmuteClicked);
mcVideoControls.btnFullscreenOn.removeEventListener(MouseEvent.CLICK, fullscreenOnClicked);
mcVideoControls.btnFullscreenOff.removeEventListener(MouseEvent.CLICK, fullscreenOffClicked);
mcVideoControls.btnVolumeBar.removeEventListener(MouseEvent.MOUSE_DOWN, volumeScrubberClicked);
mcVideoControls.mcVolumeScrubber.btnVolumeScrubber.removeEventListener(MouseEvent.MOUSE_DOWN, volumeScrubberClicked);
mcVideoControls.btnProgressBar.removeEventListener(MouseEvent.MOUSE_DOWN, progressScrubberClicked);
mcVideoControls.mcProgressScrubber.btnProgressScrubber.removeEventListener(MouseEvent.MOUSE_DOWN, progressScrubberClicked);
nsStream.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ncConnection.removeEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
tmrDisplay = null;
mcVideoControls = null;
nsStream.close();
ncConnection.close();
ncConnection = null;
nsStream = null;
objInfo = null;
shoVideoPlayerSettings = null;
strSource = null;
tmrDisplay = null;
urlLoader = null;
urlRequest = null;
xmlPlaylist = null;
}
but yeah I guess my main question comes back to, if I remove and null the entire video class, does that function run? thanks again as always.