A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Controlling multiple sounds

  1. #1
    Restarting from Scratch
    Join Date
    Feb 2001
    Location
    Sacramento, CA
    Posts
    236
    Hi people!

    I want to change the volume of just one sound.
    Here is what I got:
    Code:
    click = new Sound();
    lightclick = new Sound();
    slide = new Sound();
    click.attachSound("click");
    slide.attachSound("slide");
    lightclick.attachSound("click");
    lightclick.setVolume (20);
    This is changing the volume for all sounds not just lightclick. What wrong?

    Thanks,
    Liquid Genius

    http://www.316video.com/John/liquid

  2. #2
    cheese me. TrIzKuT's Avatar
    Join Date
    May 2001
    Posts
    771
    set the other volumes as 10

  3. #3
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    This is a tricky one - it had me stumped for ages when I came up against it.

    What you need to do is create a blank movie clip. Drag an instance on the stage for each sound you have and name each instance independently (say, clipsound1, clipsound2, etc.).

    Now, when you declare each new sound object, instead of:
    Code:
    mySound1 = new Sound();
    mySound2 = new Sound();
    use:
    Code:
    mySound1 = new Sound(clipsound1);
    mySound2 = new Sound(clipsound2);
    The rest of the code is 'as is'.

    That should do it.

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