Volume Slider bar Innital volume

I need a simple solution for my volume slider bar problem, I completed the volume slider bar tut. on kirupa and it works for what i’m doing, but i’d like the volume to default to 70 or 80 instead of 0, so that the music plays when the movie starts. I’m sure this is a simple line of code that i’m overlooking, any help would be appreciated.

Thanks!
[email protected]

you can use


mySound.setVolume(70);

that will start your sound at 70

Define the “volume” variable within the [font=courier new]load[/font] event:

onClipEvent (load) {
	mySound = new Sound();
	mySound.loadSound("sound2.mp3", false);
	//set the initial volume
	_root.volume = 70;
	//put the "dragger" movie clip in right position according to the volume
	dragger._x = line._width*_root.volume/100;
}

Thanks! that fixed it!

No problem. :slight_smile:
And welcome to kirupaForum, by the way. :stuck_out_tongue:

Thanks, I appreciate the welcome. I already have another question though…

There’s two tuts. on Kirupa on how to handle sound, one to build a soundbar and the other on how to build a volume bar. I’m trying to build a soundbar with a volume bar in it with multiple audio files. The soundbar has the audio loop imported into the library and loops alot cleaner than loading the audio file from an external MP3, which has a soundgap at the end of the loop track.

The problem is that my volume bar only references the loaded sound, not the native sound. What’s the best way to control the master volume of the movie, or is there a better way to load a soundloop?? Thanks again for all the help.

Coud you attach your file(s)? It would be easier for me to solve the problem having something to work with. :wink:

download my source here:

http://www.siliconenergy.com/flashtest/dl/sound.zip

I diddn’t include the external sound file, but the embedded one is still native.
Thanks again for all the help.

Here’s you FLA, I’ve deleted the sound symbol from the Library in order to meet to file size limit.

All you have to is to import the sound into the Library, right-click over the sound symbol, select “Linkage” from the menu, check the “Export for ActionScript”, uncheck the “Export in first frame” box, and make sure that the identifier for your sound is “Infin-calpomat-4672.wav”.

Thanks so much Kode, you’ve been a huge help.

S.

You’re welcome. :beam: