This content has been marked as final. Show 4 replies
Scratch that... I figured out what was making it stop. I have a new problem now: Why is it stopping?
The voiceover is in a Sound object called my_sound and the music is called music. Why then, when I call my_sound.stop(); does it stop the music as well? That seems crazy to me!
OK once again, scratch that - I figured it out. You have to specify the linkage ID as a parameter (Eg. music.stop("music"); ). Seems daft to me but who am I to question it?
Next issue - Sound.setVolume(). Same thing is happening - I want to apply it to one Sound object but it's happening to all of them. But this time there's no option to supply the linkage ID. It's driving me crazy! Anyone who has come across this, please reply!!
OK folks well against the odds and despite all the time I've spent talking to myself on this board I've solved the problem. I didn't find it anywhere on the web - I figured it out myself - and so I'll post the answer here for completeness and so hopefully someone else will be able to benefit from it in the future.
The trick is that when you set the volume on a sound object you are actually setting the volume on the movieclip that it's in. So if you attach your sound to _root and then setVolume on that sound, you are effectively setting the volume for the _root movieclip (ie the whole flash movie). You need to either create a new movieclip in the library and attach the sound in that or use createEmptyMovieClip() to make one on the fly with actionscript.
Once it is created you need to refer to it when you create the sound object. Here's some example code:
music.bgmusic = new Sound(_root.music);
Make sure that the sound has linkage as "bgmusic" (or whatever you want to call it)
good to know, thanks :)