I was wondering if somebody could help me adding an equalizer and volume control for the following code.
//number that is redefined when the pause button is hit
var stopPoint:Number = 1;
//a true or false value that is used to check whether the sound is currently playing
var isPlaying:Boolean;
//think of the soundchannel as a speaker system and the sound as an mp3 player
var soundChannel:SoundChannel = new SoundChannel();
var sound:Sound = new Sound(new URLRequest("demo.mp3"));
//you should set the xstop and xplay values to match the instance names of your stop button and play/pause buttons
xstop.addEventListener(MouseEvent.CLICK, clickStop);
xplay.addEventListener(MouseEvent.CLICK, clickPlayPause);
soundChannel = sound.play();
isPlaying = true;
function clickPlayPause(evt:MouseEvent) {
if (isPlaying) {
stopPoint = soundChannel.position;
xplay.gotoAndStop(2);
soundChannel.stop();
isPlaying = false;
} else {
soundChannel = sound.play(stopPoint);
isPlaying = true;
xplay.gotoAndStop(1);
}
}
function clickStop(evt:MouseEvent) {
if (isPlaying) {
soundChannel.stop();
isPlaying = false;
}
}