Advertisement
Guest User

Mute/Pause, Unmute/Play

a guest
Dec 8th, 2015
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var rosesRoom:music = new music();
  2.  
  3. var MusicChannel:SoundChannel = new SoundChannel();
  4.  
  5. var pausePosition:int = MusicChannel.position;
  6.  
  7. MusicChannel = rosesRoom.play(0, 9999999);
  8.  
  9. toggle_btn.gotoAndStop(46);
  10.  
  11. var clickOnce:uint=0;
  12.  
  13. toggle_btn.addEventListener(MouseEvent.CLICK, togglePlay);
  14.  
  15. function togglePlay(event:MouseEvent):void
  16. {
  17.  clickOnce++;
  18.  
  19.  if (clickOnce==1)
  20.      {
  21.      toggle_btn.gotoAndPlay(47);
  22.      MusicChannel.stop()
  23.      }
  24.  if (clickOnce==2)
  25.      {
  26.      MusicChannel=rosesRoom.play(pausePosition, 9999999);
  27.      toggle_btn.gotoAndPlay(1);
  28.      clickOnce=0;
  29.      }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement