| View previous topic :: View next topic |
| Author |
Message |
mattock AFC Member
Joined: 07 Mar 2008 Posts: 7
|
Posted: Sun Mar 09, 2008 1:09 am Post subject: Fading the volume? |
|
|
is there anyway to have a pause button that instead of suddenly stopping it, it instead fades the volume to a pause ?
Thanks |
|
| Back to top |
|
 |
mattock AFC Member
Joined: 07 Mar 2008 Posts: 7
|
|
| Back to top |
|
 |
mattock AFC Member
Joined: 07 Mar 2008 Posts: 7
|
Posted: Sun Mar 09, 2008 2:06 am Post subject: |
|
|
hey, i thought id share what i got to work great for the fading volume if it helps anyone else. i followed the code given in that link but i needed to change the amount it added to just a simple number for it to work properly on the fading volume back in
i have my mp3 compnent in a MC called playpause_mc
| Code: | //PAUSE_____________________________
function pauseMusic() {
isPaused = true;
//FADE VOLUME DOWN ON PAUSE_________________________
this.onEnterFrame = function() {
myPlayer.volume -= 5;
if (myPlayer.volume<=0) {
trace("deleted");
delete this.onEnterFrame;
myPlayer.pause();
}
};
//END FADE VOLUME DOWN ON PAUSE_________________________
//myPlayer.pause();
playpause_mc.gotoAndStop("play");
graphicEqualizer_mc.gotoAndStop("stop");
}
//END PAUSE_____________________________
//PLAY_____________________________
function playMusic() {
isPaused = false;
myPlayer.play();
//FADE VOLUME ON UP ON PLAY_________________________
this.onEnterFrame = function() {
myPlayer.volume += 5;
if (myPlayer.volume>=100) {
trace("deleted");
delete this.onEnterFrame;
}
};
//FADE VOLUME ON UP ON PLAY__________________________
//myPlayer.play();
playpause_mc.gotoAndStop("pause");
graphicEqualizer_mc.gotoAndPlay(1);
}
//END PLAY_____________________________ |
|
|
| Back to top |
|
 |
pseudonym AFC Member
Joined: 09 May 2008 Posts: 2
|
Posted: Wed Jul 09, 2008 7:10 pm Post subject: |
|
|
| mattock wrote: | hey, i thought id share what i got to work great for the fading volume if it helps anyone else. i followed the code given in that link but i needed to change the amount it added to just a simple number for it to work properly on the fading volume back in
i have my mp3 compnent in a MC called playpause_mc
|
I have added a bit to your code so that the volume is saved when paused and returns to the saved volume when play resumes
| Code: | var myVolume:Number = myPlayer.volume;
function pauseMusic() {
isPaused = true;
myVolume = myPlayer.volume;
this.onEnterFrame = function() {
if (myPlayer.volume > 0){
myPlayer.volume -= 5;
}
if (myPlayer.volume<=0) {
trace("deleted");
delete this.onEnterFrame;
myPlayer.pause();
}
}
}
function playMusic() {
isPaused = false;
myPlayer.play();
if (myVolume > 0){
this.onEnterFrame = function() {
myPlayer.volume += 5;
if (myPlayer.volume >= myVolume) {
delete this.onEnterFrame;
}
}
}
}
|
_________________ As always ... have a day
Nym |
|
| Back to top |
|
 |
|