Jump to content
GreenSock

rgmartino

First Time [SOLVED]

Recommended Posts

I want to control a fade out of a sound object. I try this but doesn't work. Can someone help?

 

import gs.*;

import gs.easing.*;

TweenLite.to(soundOne, 2, {volume:0});

 

var req:URLRequest = new URLRequest("firstloop.mp3");

var soundOne:Sound = new Sound();

 

function soundloaded(event:Event):void {

soundOne.play();

}

 

soundOne.addEventListener(Event.COMPLETE, soundloaded);

soundOne.load(req);

Link to comment
Share on other sites

You don't tween the volume of a Sound, you tween the volume of a SoundChannel in AS3.

Link to comment
Share on other sites

  • 1 month later...

I have a sound and sound channel that i'm trying to fade, but it's not seeming to work.

 

var sc:SoundChannel;
var song:Sound = blah;
//blah is a sound, trust me, it plays fine and everything i just don't want to put the code in here for the loading and such;
sc = song.play();

 

then when my app ends,

 

var fadeOb:Object = new Object();
fadeOb.volume = 0;
TweenLite.to(sc.soundTransform, 2, fadeOb);

 

But this doesnt work. If i use the onUpdate listener and check the volume of the soundtransfomr, it always stays at one

Link to comment
Share on other sites

Nevermind figured it out. Had to set the SoundTransform of the SoundChannel to a new SoundTransform that I created. And have to do that in the onUpdate listener. I don't like that bleh.

Link to comment
Share on other sites

Are you familiar with the VolumePlugin? You could just do this:

 

var song:Sound = blah;
var sc:SoundChannel = song.play();
TweenMax.to(sc, 2, {volume:0});

Link to comment
Share on other sites

There's an interactive example in the Plugin Explorer, just so you know.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×