Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just a thought for the guy with the Tween Sound issue #254

Open
Snky opened this issue Apr 22, 2015 · 0 comments
Open

Just a thought for the guy with the Tween Sound issue #254

Snky opened this issue Apr 22, 2015 · 0 comments

Comments

@Snky
Copy link

Snky commented Apr 22, 2015

        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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant