# Volume slider problems

**URL:** <https://forum.kirupa.com/t/volume-slider-problems/64493>\
**Category:** Uncategorized\
**Created:** [September 16, 2004, 9:16pm UTC](https://forum.kirupa.com/t/volume-slider-problems/64493 "2004-09-16T21:16:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![massive3215](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/massive3215/32/253_2.png) [@massive3215](https://forum.kirupa.com/u/massive3215)\
**Post date:** [September 16, 2004, 9:16pm UTC](https://forum.kirupa.com/t/volume-slider-problems/64493/1 "2004-09-16T21:16:43Z")

</div>

I’m making an mp3 player for my site. So far I’ve been able to get my buttons to change songs but I can’t get my volume slider to change the volume of the audio. My code is as follows.

On my main timline in my actions frame I have:

audio1 = new Sound();  
audio1.loadSound(“grow.mp3”,false);

audio2 = new Sound();  
audio2.loadSound(“stability.mp3”,false);

On button one that plays song 1, I have the following code:

on (release) {  
audio1.start(cue, 1);  
audio2.stop();  
}

My slider movie clip on my main timeline has an instance name of volSlider. Inside that movie clip I have my horizontal bar and my volume slider - instance name dragger. On the dragger movieclip I have the following code:

on (press) {  
startDrag(dragger, false, 0, 0, 50, 0);  
isDrag = “y”;  
}  
on (release) {  
\_parent.audio1.setVolume(dragger.\_x);  
stopDrag();  
isDrag = “”;  
}

Thanks for any help!

---

<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:** [September 17, 2004, 2:22am UTC](https://forum.kirupa.com/t/volume-slider-problems/64493/2 "2004-09-17T02:22:23Z")

</div>

I suppose that you already know that your slider can only give a value between 0 to 50 when the ideal would be 0 to 100.  
[AS]function changeVolume(pos){  
this.onEnterFrame = function(){  
\_parent.audio1.setVolume(pos);}}  
on (press) {  
changeVolume(dragger.\_x){  
startDrag(dragger, false, 0, 0, 50, 0);  
isDrag = “y”;  
}  
on (release) {  
stopDrag();  
isDrag = “”;  
}[/AS]

---

<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:** [September 17, 2004, 6:12pm UTC](https://forum.kirupa.com/t/volume-slider-problems/64493/3 "2004-09-17T18:12:03Z")

</div>

Could you give me a little more information as to where I should place that code in my file and what it should replace?

> [@Dulcinea](#):
>
> I suppose that you already know that your slider can only give a value between 0 to 50 when the ideal would be 0 to 100.  
> [AS]function changeVolume(pos){  
> this.onEnterFrame = function(){  
> \_parent.audio1.setVolume(pos);}}  
> on (press) {  
> changeVolume(dragger.\_x){  
> startDrag(dragger, false, 0, 0, 50, 0);  
> isDrag = “y”;  
> }  
> on (release) {  
> stopDrag();  
> isDrag = “”;  
> }[/AS]
