Hi,

Here is a Sound prototype I often use. You can also easily set it as a
function in a sound class:

Sound.prototype.volumeTo=function(nTarget:Number,step:Number,post_func:Funct
ion){
    var a=nTarget - this.getVolume();
    var v=this.getVolume();
    var dir=a/Math.abs(a);
    if(this["_soundfade_ID"]!=undefined){
        if (nTarget != v) {
            if (Math.abs(nTarget - v)>step && v>=0 && v<=100) {
                this.setVolume(v+(step*dir));
            } else {

                this.setVolume(nTarget);
            }
        } else {
            clearInterval(this["_soundfade_ID"]);
            delete this["_soundfade_ID"];
            if(post_func != undefined){
                post_func();
            }
        }
    } else if(nTarget != v){
        
this["_soundfade_ID"]=setInterval(this,"volumeTo",50,nTarget,step,post_func)
;
    }
}


On 7/11/05 11:00, "MetaArt" <[EMAIL PROTECTED]> wrote:

> In my movie, I have a jingle, that is loaded by this code:
> 
> code:-----------------------------------------------------------------------
> -------track = new Sound();
> track.loadSound("everybody.mp3", true);
> track.setVolume(0);
> vol = 0;
> fade = setInterval(fadeIn, 100);
> function fadeIn() {
> vol += 1;
> track.setVolume(vol);
> if (vol>=90) {
> clearInterval(fade);
> }
> };--------------------------------------------------------------------------
> ----
> during playback of this jingle, is possible that happens an event (a
> rollOver action) by the user that start the playback of an other audio file,
> this time a talkin' human voice.
> The problem is that the jingle cover the voice, or whatever the two audios
> overlaps.
> Therefore, I want do something that, on rollOver, do the jingle has a fast
> fadeOut, starting by the volume level where it is.
> How can I obtain this?
> 
> 
>      Enrico Tomaselli
>   +> web designer <+
>   [EMAIL PROTECTED]
> http://www.metatad.it
> 
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 

______________________________
Pascal FODOR
http://www.flashavplayers.com
______________________________















_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to