flash actionscript:
Ok, here is my latest 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; trace(fadeInIncr) } var snd:Sound = new Sound(new URLRequest("myLoop.mp3")); var trans:SoundTransform = new SoundTransform(fadeInIncr, 0); // 1=vol, 0=pan var channel:SoundChannel = snd.play(0, 1, trans); When viewing the trace output, the "fadeInIncr" varible is being increased like it is supposed to. However, the volume is not increasing. Any Ideas?
I'm trying to write a function that will Fade In a given mp3 called via the following method: var sAmbience:Sound = new Sound(); sAmbience.load(new URLRequest("ambience.mp3")); var sAmbienceVol:SoundTransform = new SoundTransform(0.7, 0); I also want a function that will Fade Out the sound...I knew how to do this in AS2 Any help would be greatly appreciated. Thx -D
you sound (sAmbience.play() ) returns a soundchannel instance which has a soundTransfrom property. that soundTransform property has a volume property that will set the volume for your sound (sAmbience). you can use any loop (ENTER_FRAME or timer) to fade that volume property.
kglad, Thank you for your response. I trigger the sound to play like this: sAmbience.play(0,1,sAmbienceVol) and that of course starts playing the mp3 no problem, so your saying decrement/increment the "sAmbineceVol" ? Could you give me an example of the loop? I realize your not here to "write my code for me", but this seems to have me stumped.
read the help files. i listed all the steps involved. here they are in code: var sc:SoundChannel = sAmbience.play(0,1);
Don't see what you're looking for? Try a search.
|