# Volume sliders, multiple tunes!

**URL:** <https://forum.kirupa.com/t/volume-sliders-multiple-tunes/434>\
**Category:** flash\
**Created:** [July 17, 2002, 3:11pm UTC](https://forum.kirupa.com/t/volume-sliders-multiple-tunes/434 "2002-07-17T15:11:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ControlB](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@ControlB](https://forum.kirupa.com/u/ControlB)\
**Post date:** [July 17, 2002, 3:11pm UTC](https://forum.kirupa.com/t/volume-sliders-multiple-tunes/434/1 "2002-07-17T15:11:32Z")

</div>

I’m using the volume slider that can be found in the Macromedia Support Forum. The thing is, I need it to control more than one sound.  
e.g. What I want to happen:  
snd.tk0 is playing. Use the slider to change the volume to, say, 47%.  
Then you stop snd.tk0 playing and start snd.tk1 - at 47%

The problem seems to be in the button’s “onClipEvent (enterFrame)” command, which refuses to recognise a global variable. Can anyone help me with this, please?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 17, 2002, 4:24pm UTC](https://forum.kirupa.com/t/volume-sliders-multiple-tunes/434/2 "2002-07-17T16:24:34Z")

</div>

Declare each sound object within a different MC instance then target that instance to scope the volume property. The easiest way to do this is to use the onClipEvent (load) property to instantiate the sound object

onClipEvent (load) {  
mysound=new Sound()  
mySound.attach sound(\_name)  
}

If you use this method then you can create multiple instances of a MC using the duplicateMovieClip() function and if you use a incrementing file name which matches the linkage of your sound files (i.e use a for loop from 11 to 21 say and give your soundfile linkages like mc11, mc12, mc13, etc) then you’ll have instantiated and scoped your soundfiles

To control the volume then reference an individual MC instance

mc11.mySound.setVolume(45)  
mc19.mySound.setVolume(66) etc
