g3code
02-18-2010, 02:16 AM
So I have a container on my stage that different kinds of content get added to, depending on which button is clicked. Videos (FLVPlayers), MovieClips and Sprites are all possibilities.
When a button is clicked, I want it to remove the content that is in the container. Only one object at a time is there, so I could use removeChildAt(0)...but the problem is, when the content is a video, I need to "stop" it first, then remove it. But if my removal code tries to stop it and it's not a video, I'll get an error.
How can my generic removal code detect if the child is a video or not before executing a stop order, *then* removing?
I haven't really written any code yet. I'm kind of stumped as where to start, because I'm really concerned about garbage collection/memory management and I want to do this right from the beginning.
Thanks in advance.
When a button is clicked, I want it to remove the content that is in the container. Only one object at a time is there, so I could use removeChildAt(0)...but the problem is, when the content is a video, I need to "stop" it first, then remove it. But if my removal code tries to stop it and it's not a video, I'll get an error.
How can my generic removal code detect if the child is a video or not before executing a stop order, *then* removing?
I haven't really written any code yet. I'm kind of stumped as where to start, because I'm really concerned about garbage collection/memory management and I want to do this right from the beginning.
Thanks in advance.