A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: Is it possible to change the sound volume on individual attached sound clips?

  1. #1
    Amiga freak Ironclaw's Avatar
    Join Date
    Jan 2001
    Location
    Sweden
    Posts
    1,650

    Is it possible to change the sound volume on individual attached sound clips?

    For instance, I have 2 attached sound samples, both playing continuously. I want to be able to control the volume for both separately.

    All I know I can use is setVolume, but that one seems to be global only and changes the volume on both.

    I tried having different names on the attached sounds (sound1, sound2) and had the volume buttons refer to sound1.setVolume and sound2.setVolume, but each of them controlled both sounds. Also tried attaching the sounds into individual MCs, but got the same result .

    So, can this be done?

    Edit: oh, there was a forum for sound and music, my bad. Can seem to find how to delete this thread so have to leave it here or if some mod moves it.

    Edit2: Ok, think I got it to work, was trying this method before posting (from FAQ), but couldn't get it to work... might have now... buggy it seems.
    Why is my sound object controlling volume or pan of all sounds in the movie?
    a sound object without an associated mc is a "global" sound object and controls volume and pan of all loaded sounds.

    to ensure that a sound object controls just one sound pass the target path of a unique movie clip to the sound function.

    myuniquesound = new Sound(target path to unique mc);

    OR

    // dynamically create a mc and associate it with a sound object
    soundobject = new Sound(createEmptyMovieClip("snd",getNextHighestDep th()));
    Edit3: Problem solved .
    Last edited by Ironclaw; 03-06-2008 at 09:49 PM.

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