-
1. Re: I removeChild but audio still plays
Lujunq Jul 16, 2009 1:25 PM (in response to BrianatArena)When you remove the movieclip using "removeChild" you're only taking if off the display list, so it is not seen. However it is still there and you'll hear any sound it produces... To avoid this you must unload it, delete it or do anything to completeley remove it (not only taking it off the display list). In this case, since you're using the Loader Class you may simply call the unload method:
eventOdd.removeChild(eventInitialLoader);
eventInitialLoader.unload();
Check the docummentation for this unload method (Loader Class) since it may be necessary to clear event assignments or associated netstrems before calling it.
-
2. Re: I removeChild but audio still plays
BrianatArena Jul 16, 2009 2:26 PM (in response to Lujunq)Well I tried that and audio still plays. Checked several other forums and to the best of my searches this is one of those issues that never provides a solution. Someone recommended SoundMixer.stopAll(); which will do for now. Thanks.
-
3. Re: I removeChild but audio still plays
timlitos Aug 24, 2009 2:54 PM (in response to BrianatArena)I am having a very similar issue but my set up is a bit different. I am loading the video this way:
addChild(AL_mc);
and was trying to remove it this way:removeChild(AL_mc);So the video goes away but the audio stays playing. Is there a way of fixing this with my current code intact? or do I need to set things up differently?Thanks! -
4. Re: I removeChild but audio still plays
Lujunq Aug 24, 2009 3:37 PM (in response to timlitos)You must always remember that just removing an object from display list won't "kill" it: it'll be still active and running. At your case I would first stop the video, then remove it from display list ( removeChild(AL_mc); ), then, if it is not to be used anymore, make it free for the garbage collector (something like AL_mc = null; ). But remember that you must remove all references to this object for it to be completely removed. Also, any event listeners registered to it must be removed.
-
5. Re: I removeChild but audio still plays
timlitos Aug 24, 2009 5:08 PM (in response to Lujunq)thanks!
so the code should look like this:
removeChild(AL_mc);Al_mc = null;???and what snippet of code should I use to stop the video first? -
6. Re: I removeChild but audio still plays
Mike6679 Sep 11, 2009 8:46 AM (in response to BrianatArena)Hey BrianatArean I have the same problem . Were you using the Video class? I user this code to kill everything but the audio still plays:
public function stopIt()
{
video.clear();
ns.close();
}
//-------------------------------------------
public function killIt()
{
trace("VideoHandler.killIt() called");
stopIt();
_stage.removeChild(video);
nc.removeEventListener (NetStatusEvent.NET_STATUS,checkConnect);
ns.removeEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
nc.close();
video = null;
ns = null;
nc = null;
flag_Running =false;
} -
7. Re: I removeChild but audio still plays
BrianatArena Sep 11, 2009 8:51 AM (in response to Mike6679)I had to use stopAllSounds();. And it works. But I could see how this would suck if you wanted other sounds to continue playing.
-
8. Re: I removeChild but audio still plays
Mike6679 Sep 11, 2009 9:02 AM (in response to BrianatArena)thx for the reply....Ah, funny I use AS3 and I was JUST looking at the equivalent which is SoundMixer.stopAll(); hmmm yeah it will work for me but it no good if you only want to stop one audio clip from a movie.
If you are trying to stop your vid from a parent video, In CS4 there wil be a function called "imgLoader.unloadAndStop()" will will supposedly take care of this issue......
thanks again
-Mike
-
9. Re: I removeChild but audio still plays
Triynko Oct 25, 2009 7:23 PM (in response to Lujunq)And how exactly are we supposed to know about and remove or stop every movieclip, registered event, or sound clip playing in an externally loaded swf file? First, you'd have to be the one who built it, which is not necessarily the case, and even if we did... for something like an Adobe Captivate swf, there is no documented ActionScript API for those.... so we're basically screwed until Adobe releases the source code for Loader.unloadAndStop and makes it available in a form compatible with flash player 9. UNLOAD means UNLOAD, as in the opposite of LOAD. The current Loader.unload method doesn't unload anything, and doesn't seem to be much different than just calling removeChild.
-
10. Re: I removeChild but audio still plays
Lujunq Oct 26, 2009 4:35 AM (in response to Triynko)Well, considering external swf files with sound I had success using flash standard methodsto "remove" them. First, I always remove any listener associated with the loader (I guess remaining listeners may prevent the unload method to work). Then, I remove the child, call the unload method and, to make sure, I set the loader itself to null. This seems to work for me...

