Skip to main content
AttaBoy2
Inspiring
March 27, 2009
Answered

sound keeps playing after swf closed

  • March 27, 2009
  • 2 replies
  • 664 views
I'm building a web site that uses swf's as pages. The menu.swf has 5 buttons one for each page. When I press a button it loads a page with addChildAt(page, 0); so that the menu is always a level above the currently loaded page. When one of the pages open it plays a mp3 in a loop. The music keeps playing when another page loads. The page that was playing the music was also on level 0 so it's gone yet the music keeps playing. How do I make it so the music stops when another page loads?
This topic has been closed for replies.
Correct answer AttaBoy2
I tried communicating to the SoundChannel object in the child swf no luck there, I was able to unload the child from the parent swf with both loader.unload(); and this.removeChildAt(0); but I still have the same the music just keeps playing.

2 replies

xchanin
Participating Frequently
March 27, 2009
private var channel:SoundChannel = new SoundChannel();
channel.stop();
AttaBoy2
AttaBoy2AuthorCorrect answer
Inspiring
March 28, 2009
I tried communicating to the SoundChannel object in the child swf no luck there, I was able to unload the child from the parent swf with both loader.unload(); and this.removeChildAt(0); but I still have the same the music just keeps playing.
Inspiring
March 27, 2009
Make sure you stop your sound before unloading the content.
you can do that in a function that listenes to the unload Event for your clip. There, you should stop your sound, and also it is best to remove any eventlisteners you have in there (Especially event listeners that go from the top down, like listeners to stage events, cause these listeners might stop garbage collection from removing the stuff from memory)