# Kirupa's volume control slider tute

**URL:** <https://forum.kirupa.com/t/kirupas-volume-control-slider-tute/181623>\
**Category:** Uncategorized\
**Created:** [March 11, 2006, 12:11am UTC](https://forum.kirupa.com/t/kirupas-volume-control-slider-tute/181623 "2006-03-11T00:11:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorelei](https://avatars.discourse-cdn.com/v4/letter/l/b4bc9f/32.png) [@lorelei](https://forum.kirupa.com/u/lorelei)\
**Post date:** [March 11, 2006, 12:11am UTC](https://forum.kirupa.com/t/kirupas-volume-control-slider-tute/181623/1 "2006-03-11T00:11:46Z")

</div>

Hi. I followed the tutorial for the volume control slider at:

[http://www.kirupa.com/developer/mx/volume\_slider.htm](http://www.kirupa.com/developer/mx/volume_slider.htm)

I would like to know how I can set it so that the music starts  
playing automatically without having to move the volume control  
slider. I changed a part of it already so that the sound starts  
automatically but the volume bar makes it so that I can’t hear  
the music at all unless I move the slider up.

Is there a way to fix this?

Thanks for any help.

Here is the code on the slider mc:

onClipEvent (load) {  
mySound = new Sound();  
mySound.loadSound(“sound2.mp3”, true);  
}  
onClipEvent (enterFrame) {  
downloaded = mySound.getBytesLoaded();  
total = mySound.getBytesTotal();  
if (downloaded != total) {  
\_root.dl = “downloading song…”;  
} else {  
complete = 1;  
\_root.dl = “”;  
}  
mySound.setVolume(\_root.volume\*2);  
}

Here is the code inside the volume control bar:

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;

Thanks for any advice!
