tags:

views:

196

answers:

1

Hi, I have a videoDisplay object in a popup. When I remove the popup the video continues to play. How do I remove the videoDisplay object from memory? I have tried setting the variable to null but with no luck. I can just call the stop() function and forget about it but am wondering whether this won't come back and bite me.

Any help much appreciated.

+1  A: 

Stopping would be enough. Remove any event listeners attached to it to make sure that it is garbage collected. If the control is is streaming from the Flash Media Server, call the close() method after calling the stop(). The close method forces the close of an input stream and connection to Flash Media Server.

Amarghosh
Thanks for the help. I presume by setting the var to null will be enough to make sure it is garbage collected?
Chin
No, you have to remove event listeners too. Each event listener creates a reference to the object - unless you call addEventListener with `useWeakReference` (the fifth parameter) = true
Amarghosh
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/EventDispatcher.html#addEventListener()
Amarghosh