My favorites | Sign in
Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 10: Stats needs a way to be destroyed
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Oct 21
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by joshtynjala, Apr 24, 2009
When Stats is removed from the stage, it should clean up after itself. This
is especially important if it used in a SWF that may be unloaded because
Stats could keep the SWF in memory!

Add the following line to the end of the init function:

addEventListener(Event.REMOVED_FROM_STAGE, destroy);

Then add this function to clean up the event listeners and the bitmapdata:
		
private function destroy(e : Event) : void
{		
	removeEventListener(MouseEvent.CLICK, onClick);
	removeEventListener(Event.ENTER_FRAME, update);
	removeEventListener(Event.REMOVED_FROM_STAGE, destroy);

	_graph.dispose();
}
Comment 1 by ricardo.cabello, Oct 21, 2009
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment

Hosted by Google Code