# Problem with volume slider

**URL:** https://forum.kirupa.com/t/problem-with-volume-slider/25397
**Category:** flash
**Created:** [July 12, 2003, 8:01am UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397 "2003-07-12T08:01:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![drclare](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@drclare](https://forum.kirupa.com/u/drclare)
#### Post date: [July 12, 2003, 8:01am UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397/1 "2003-07-12T08:01:10Z")

</div>

I created a volume slider using the “Slider Bars” tutorial and the “Creating a Volume Slider” tutorial, and everything works, excepts when the sound starts it starts at 0 volume. Well, it actually starts at 100 but very quickly jumps to 0. But then when you click on the slider it goes to the volume of the slider level. All of my code is the same as in the two tutorials, except i used the .attachsound method instead of .loadsound on the slider movie clip. Anyone know why this happens? Thanks.

---

<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 12, 2003, 9:38am UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397/2 "2003-07-12T09:38:38Z")

</div>

I havn’t seen the tutorials but when you declare the sound using .attachsound do you also use soundName.setVolume(100); to make it automatically 100% volume?

---

<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 12, 2003, 11:40am UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397/3 "2003-07-12T11:40:20Z")

</div>

make a var controlling sounds volume and make it 100 😉

---

<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 12, 2003, 7:41pm UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397/4 "2003-07-12T19:41:10Z")

</div>

Yes, i tried that but it didn’t work. Here is my code on the first frame inside the slider movie clip:

this.ratio = 0;  
dragger.onPress = function(){  
this.startDrag(true,0,0,line.\_width,0);  
this.onEnterFrame = function(){  
ratio = Math.round(this.\_x\*100/line.\_width) ;  
\_root.volume = ratio  
}  
}  
dragger.onRelease = dragger.onReleaseOutside = stopDrag;

Here is my code on the slider movie clip:

onClipEvent(load){  
song = new sound();  
song.attachSound(“dn0021.aif”);  
song.start(0, 10);  
song.setVolume(100);  
}  
onClipEvent(enterFrame){  
song.setVolume(\_root.volume);  
}

---

<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 12, 2003, 8:28pm UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397/5 "2003-07-12T20:28:31Z")

</div>

```auto
onClipEvent(load){
song = new sound();
song.attachSound("dn0021.aif");
song.start(0, 10);
_root.volume = 100;
}

```

??

---

<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 12, 2003, 9:01pm UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397/6 "2003-07-12T21:01:19Z")

</div>

great kax, that works. Thank you.

---

<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 12, 2003, 9:02pm UTC](https://forum.kirupa.com/t/problem-with-volume-slider/25397/7 "2003-07-12T21:02:56Z")

</div>

you’re welcome. :beam: 😛
