Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-01-2008, 03:43 PM   #11
RealitysFugitive
Registered User
 
Join Date: Aug 2008
Posts: 1
Default

I need a little help. I used your code with my animation, (changing all the variable names so it would work) and it works initially. However, there's a point in the animation where I pause the sound for a few frames and then restart it. The code I have for the frame it starts up again is this:

ActionScript Code:
myChannel = myAudio.play(myPausePosition, 1, trans)

(Where "trans" refers to the same variable as before) But it doesn't fade the sound in again. It just resumes it, but with a much quieter volume. I'm pretty new to actionscript, so I can use some help figuring out how to fix this.

Also, I want to fade out the music later, so I just copied your code and changed things around a bit, but it's not working. If someone could tell me how they would do it, that would be a big help too.
RealitysFugitive is offline   Reply With Quote
Old 01-13-2010, 12:38 AM   #12
rover87
Registered User
 
Join Date: Jan 2010
Posts: 6
Default

Hi everybody,

I came across the post by google and I'm looking for a way to implement this in my code.

When my flashmovie starts there is a sound that starts playing. When I click a button, how can I get the sound to fade away?


The following code is placed at the top of my actions frame:
Code:
var soundFadeInTimer:Timer=new Timer(100,30);
soundFadeInTimer.addEventListener("timer", soundFadeIn);

soundFadeInTimer.start();

var fadeInIncr=-0.1;

function soundFadeIn(e:TimerEvent) {
	fadeInIncr-=1/30;
	var sAmbienceVol:SoundTransform=new SoundTransform(fadeInIncr,0);
	channel.soundTransform=sAmbienceVol;
}

var snd:Sound=new Sound(new URLRequest("sounds/bulb.mp3"));
var trans:SoundTransform=new SoundTransform(1,0);
var channel:SoundChannel=snd.play(.1);
I'm looking for a way to change the fade in, to fade-out. Hope someone can help me with this little problem .

Rogier
rover87 is offline   Reply With Quote
Old 07-26-2010, 08:27 PM   #13
francescomm
Registered User
 
Join Date: Jul 2010
Posts: 1
Post

Code:
// START SOUND

var mySound:Sound = new Sound();
var channel:SoundChannel=new SoundChannel();

mySound.load(new URLRequest("audio.mp3"));  

channel = mySound.play();
channel.soundTransform = new SoundTransform(.5, 0.0);
// START VOLUME IS 50% = .5





// FADE OUT SOUND

var sndFadeInterval=null;
sndFadeInterval=setInterval(function(chan) {
	var vol=chan.soundTransform.volume;
	vol-=.01;
	if(vol<=0) {
		if(sndFadeInterval!=null) clearInterval(sndFadeInterval);
		sndFadeInterval=null;
		chan.stop();
		trace("stop")
	} else {
		chan.soundTransform.volume=vol;
		trace("Volume: "+chan.soundTransform.volume)
	}
 },50,false,channel);

Same applies for Fade in. You may use tweens too, of course. Just set channel.soundTransform.volume=XXX
francescomm is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Sound Fading greenpear ActionScript 2.0 3 10-26-2007 01:38 PM
Kenny Bellew Sound Object Tutorial Updated Kennyb ActionScript 2.0 23 05-09-2007 08:38 PM
[stuff] as3 sound visualising efx arrFoo ActionScript 3.0 0 02-01-2007 09:53 AM
[F8] Fading out specific sound while keeping others active Trinidad ActionScript 2.0 2 07-14-2006 05:26 PM
Control Sound Object puthisorn ActionScript 2.0 9 05-06-2004 04:20 AM


All times are GMT. The time now is 05:22 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.