PDA

View Full Version : remove netstream???


davej
06-25-2009, 03:44 PM
Hi All
I have problem closing or removing a netstream object. the object is created in a class I wrote. that class is added to a sprite object. when I remove the sprite which the netstream is a child of the netstream still plays. I know I can use close() to close the netstream but the problem is that the object that removes the sprite does not know that there is a netstream object in the sprite. Is there some universal close or any suggestions? hope this makes some sense.

daveystew
06-25-2009, 10:37 PM
Good OO practice and encapsulation demands that all objects are responsible for their own internals, so external objects would not and should not know about any internal classes.

Create a public destroy() method for your class that does all the internal cleanup, and call that as well as, or instead of, just removing the child.

davej
06-26-2009, 03:14 PM
easier said then done. the object doing the destroying does not know the object with the netstream exist with in it, as it is several layers with in. think of my main object as a gallary class that can contain varius objects including other gallaries that contain a netsream. When I remove the main gallery object all nested object should be removed or destroyed. it all works excep the netsream audio continues to play.