public function tweenVolume(id:String, volume:Number = 0, tweenDuration:Number = 2, callback:Function = null):EazeTween{
if (soundIsPlaying(id)) {
var citrusSound:CitrusSound = CitrusSound(soundsDic[id]);
var tweenvolObject:Object = {volume:citrusSound.volume};
var tweenvolTween:EazeTween = new EazeTween(tweenvolObject).to(tweenDuration, {volume:volume})
.onUpdate(function():void {
citrusSound.volume = tweenvolObject.volume;
}).onComplete(function():void
{
if (callback != null)
if (callback.length == 0)
callback();
else
callback(citrusSound);
});
return tweenvolTween;
}
else
{
trace("the sound " + id + " is not playing");
return null;
}
}
Perhaps you could return the tween, although, you would most likely have to keep a 'private var' reference to it, then may even have to manually cut the reference free when he wanted to also call stop sound? So maybe this idea is a little too complicated, I'm not sure, I guess he could also tween the volume manually using EazeTween, and not this function, and do what I said above o0..
Perhaps you could return the tween, although, you would most likely have to keep a 'private var' reference to it, then may even have to manually cut the reference free when he wanted to also call stop sound? So maybe this idea is a little too complicated, I'm not sure, I guess he could also tween the volume manually using EazeTween, and not this function, and do what I said above o0..