Pause & play sound & maintain soundTransform settings

Pause and play works, but I loose sound vol settings on resume play

Page 1 of 1

0 Replies - 1019 Views - Last Post: 18 September 2009 - 12:42 PM

#1 DigitalMonk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 16-June 09

Pause & play sound & maintain soundTransform settings

Posted 18 September 2009 - 12:42 PM

The is only one problem I can't find a solution for. The pause and play functionality works, but I lose my initial soundTransform properties when I resume play. Note the second line in the code where I set the volume to (0.2). Deeper in the script where I resume playback at the pausePosition, it continues playing at the correct position but the volume resets to 1. How would you resume play and retain the volume level?

//soundbed vars and start soundbed titled "theme"
var mySound:Sound = new theme();
var sndVol:SoundTransform = new SoundTransform(0.2);
var channel:SoundChannel = mySound.play(0,2,sndVol);



//music pause - play code

//button mouse over event
musicOn_mc.musPause_mc.addEventListener(MouseEvent.MOUSE_OVER,overMus);
function overMus(e:MouseEvent) {
	musicOn_mc.musPause_mc.gotoAndStop("over");
}

//pause and play event
musicOn_mc.musPause_mc.addEventListener(MouseEvent.CLICK,togMus);
function togMus(e:MouseEvent) {
var pausePosition:int = channel.position;
	if (musOn) {
		channel.stop();
		musicOn_mc.musPause_mc.gotoAndStop("off");
		musOn = false;
	} else {

//THIS IS THE PROBLEM

		channel = mySound.play(pausePosition);

//END OF PROBLEM

		musicOn_mc.musPause_mc.gotoAndStop("on");
		musOn = true;
	}
}

//Pause button rollout code
musicOn_mc.musPause_mc.addEventListener(MouseEvent.MOUSE_OUT, Musout);
function Musout(event:MouseEvent):void {
	if (musOn) {
		musicOn_mc.musPause_mc.gotoAndStop("on");
	} else {
		musicOn_mc.musPause_mc.gotoAndStop("off");
	}
}



Thanks for looking

Is This A Good Question/Topic? 0
  • +

Page 1 of 1