Volume and Pan control with external swfs and mp3s?
Hi,
I need some help, I decided to expand my knowledge of Flash with sound. And I would like to have on my Flash jukebox; a volume slider and pan control. I'd like to learn how to do this with swfs and mp3s. As I know how to play, stop etc using external swfs and streaming mp3s.
Can anyone point in the right direction of tutorials, help etc? I have been googling for hours and not turning up anything...
My jukebox contains several external sound files, the only things I ran across was something for a single sound file.
The example file had a parameter of "music0.mp3" but that mean it would only work with one sound file? I am a tad lost at this point now. Surely it'd need some kinda generic name. Otherwise it will only pan and volume one sound, as I have many? Sorry if I seem abit dense, as I am just learning this stuff.
Unless I have that in each swf, with the mySound name reletive to the mp3 name. O1.mp3, 02, mp3 etc. So it'd load the sound and the volume and pan with it?
mySound = new Sound();
mySound.loadSound("music1.mp3", true);
The sound object to target is mySound. Use that over and over, just changing the name of the sound file to load, music0.mp3, music0.mp3, music2.mp3, whatever. The important part is the sound object name, mySound.
If your loading sounds in a swf with nothing but the sound in it, you need to add a dummy sound object so you can target that sound:
mySound = new Sound(this);
Same thing, you target the sound object to control it, using whatever the full path to it may be. In my example, it was _root.mySound.
another way to think of it, is that a sound object is a container for mp3, much like a level or movie clip is a container for an external SWF. You tell the container what to do not the sound or swf itself.
Put the sound in the container, using loadSound().
Control pan and volume by telling the container to change pan or volume.
mp3Player = new Sound(this); // create the container
mp3Player.loadSound("anyold.mp3",true); // put sound in the container
mp3Player.setVolume(50); // change volume of whatever sound in container