Advanced Flash Components
Search!
Search!
Home >  Forum
  SearchSearch   
Fading the volume?

 
Post new topic   Reply to topic     Forum Index -> MP3 Player
View previous topic :: View next topic  
Author Message
mattock
AFC Member


Joined: 07 Mar 2008
Posts: 7

PostPosted: Sun Mar 09, 2008 1:09 am    Post subject: Fading the volume? Reply with quote

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
View user's profile Send private message
mattock
AFC Member


Joined: 07 Mar 2008
Posts: 7

PostPosted: Sun Mar 09, 2008 1:26 am    Post subject: Reply with quote

sorry i found another post on this http://www.afcomponents.com/forum/viewtopic.php?t=654

ill give it a go
Back to top
View user's profile Send private message
mattock
AFC Member


Joined: 07 Mar 2008
Posts: 7

PostPosted: Sun Mar 09, 2008 2:06 am    Post subject: Reply with quote

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
View user's profile Send private message
pseudonym
AFC Member


Joined: 09 May 2008
Posts: 2

PostPosted: Wed Jul 09, 2008 7:10 pm    Post subject: Reply with quote

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 Neutral

Nym
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MP3 Player All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group