A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Multiple Sounds

  1. #1
    Hey guys,

    I have two buttons controlling each their sound at the same time, but when I turn one of them off, it automatically turns the other off too; even though I have assigned different names for each sound.

    I am using this script for one of the buttons, with the "voice" label changed to "ambience" for the second button:

    voice = new Sound();
    voice.attachSound("voice");
    voice.setVolume(0);
    voice.start(0, 50000);

    ... I use "voice.setVolume(0);" when I turn 'off' the sound on the first button and "voice.setVolume(100)" to turn it 'on' again. For the second button I use "ambience.setVolume(0);" and "ambience.setVolume(100);" ...

    Anyone who can help me figure out why they control eachother?

    Thanks!
    :: serviator

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    I just answered this in the thread below yours...

    "to do this you must make sure you include the linkage ID in the call to stop the sound:

    _root.mySound.stop("mySoundID")

    If you leave out the linkage ID, all sounds will stop.

  3. #3
    I don't know how I could have missed that post ?:/

    I understand that including the linkage ID might work, but how do I refer to it when the sound is in my library and I have selected the sound symbol, chosen "Linkage" and given the identifier the name "voice" - besides writing "voice.setVolume(0);"? I don't have the sound in any movieclips that I can refer to.

    Thanks!
    :: serviator

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    Sorry, my reference to the other post was just so people wouldn't go... "Didn't I just read that?"

    In looking at your code below, your linkage id "voice" needs to be different than the name you gave to the sound object. I recommend "voice01" - it makes it easy to remember.

    You do not need to have the sound file on stage. It remains in your library. Select Linkage and the select "Export for ActionScript" and give it the new ID of "voice01".

    If you defined the sound object on the _root level:

    voice = new Sound();
    voice.attachSound("voice01");

    Then, when you want to start it:

    _root.voice.setVolume(100);
    _root.voice.start(0,5000);

    You do not need to set the volume at zero - just stop it.

    //and when you want to stop it:

    _root.voice.stop("voice01")

  5. #5
    Oh, I actually wasn't even being sarcastic, I did miss the post similar to mine

    Anyway, I did everything according to how you suggested it, except I hadn't included the "_root." parameter, so I tried it but still no luck (actually everything stopped playing at all of some reason).

    I uploaded an FLA and SWF file, would you mind having a quick look at them, so you can see what I am talking about?

    Oh, I do need to set the volume at zero, as I don't want the voice to stop, but to keep reading even though people have "turned it off", so when they turn it on it'll still match the captions I am using.

    Files here:
    http://www.serviator.dk/sound.fla
    http://www.serviator.dk/sound.swf

    Thanks again!
    :: serviator

  6. #6
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    Sure, I should be able to look at it soon.

  7. #7
    Great, that'll help me to have another set of eyes look at it as I am stuck. Thanks Kenny!

  8. #8
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    I wasn't sure exactly what you were trying to accomplish in your file. Take a look at the changes i made and see if it's closer to what you are trying to do. Otherwise, send me an email to : aspirin99@hotmail.com and we can disscuss it further.

    http://aspirin99.guardianhosting.net/misc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center