Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

fading the volume of all non-looping event sounds in an mc or root?

   hello ..i require some assistance : i have a looping animation assigned to each section of my site { a dog performing various tricks } ..with each animation come various miscellanious soundFX triggered on event ..what i would like to have happen after a certain time period { which can be specified by x number of frames if necessary } / once the animation has run through the loop two or three times ..i'd like all sounds relating to this animation / mc ONLY to fade out so as not to annoy the end user ..is this possible .[?]..

    i have tried to adapt a few 'fade out' tutorials but they only tend to effect looping sounds... .. .

    the solution to this question would be a very handy piece of script because it could be adapted to fade out all the root mc sounds too { presumeably } which is indeed handy 'cos that would mean that the end user can effectivly turn off { fade out } ALL sounds - rollover soundFX etc NOT just the background music... .. .

    please advise

    much appreciated

    tim ferguson
    the aural encosion theory
                ___  __  _
         S;'~~
       `;s;._
         `"ýSs,
              `~$S:
                 .sS'
 .s%Ss. _..s$ý'
$ý' `ý"s
`.
0
encosion
Asked:
encosion
  • 4
  • 3
  • 2
  • +1
1 Solution
 
NinfoxCommented:
This is one way you can do it. One the MC Dog or whatever, make three keyframes. Whereever you press the button, add that to the MC. Add it so on the button it goes to the next frame. Then add a fourth one that goes back to the third. On the third one make the sound lower or whatnot. I think that solves your problem.
0
 
rascalpantsCommented:
you could make a movieclip that when initiated would have code in each frame that would steadily lower the volume of the specific movieclip sound...

something like this in every frame:

n--;
audioclip.setVolume(n);

or you coule decrease the value by multibles of 2 or 5 or what ever...  for the above code, it would take 100 frames to fade all of the way out...

you could use just one clip for this and use variables to set the name of the audio clip that is playing and then same for the fade out...


this is just one sneaky way to do it...

you should adapt it into your own code, and try to explore the possibilities...



rp

0
 
henrywwCommented:
if u are using mx, u can have the sound start, stop, fade ... anytime a particular frame, loop once, or twise then stop ... anything u want :)

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
encosionAuthor Commented:
thank you for your comments however i don't think the question has been understood : in each looping mc where the dog performs a trick, there are several 'one shot' sounds triggered on event ..these sounds are very short and do not loop { for example when the dog drops the ball a bounce / boing sound is triggered } ..there are several short 'one shot' sounds triggered in each animation... .. .

my experience of the sound object setVolume() is that it only sets the volume of a specific sound that is already playing / looping ..NOT the global volume of the mc or root so that all new sounds triggered are affected by the volume change... .. .

any ideas .[?]..
0
 
rascalpantsCommented:
you can just put all of the sounds in a movieclip and use the setVolume() if that is what you need...

do you want to mute the entire movie or just a sound clip?


entire movie = stopAllSounds();
movieclip = setVolume();


what do you want to do?

rp
0
 
henrywwCommented:
arr ... i am sure if i understand now ...
so the dog does the trick in a loop right ...
and it has some sounds attached to it ...

have a sound object to play the sound if it has been played a few times during the session then u want it to stop??

have a few sound objects and a variable to check if that sound has been played enough ..

like ... eg
// frame 1 main timeline
sndplayed = 0;
sndBg = new Sound Object();
sndFx = new Sound Object();

ok .. assume u have all the sounds exported (linked)




when the is playing the trick1 movieclip
in that movieclip

//frame 1 - have the 1st frame in each clip to init the sound object
_root.sndplayed=0;
_root.sndBg.setVolume(100);
_root.sndBg.attachSound("myBGmusic1");
_root.sndFx.attachSound("ballFx");

//frame 2
_root.sndplayed++;
_root.sndBg.start();
_root.sndBg.onSoundComplete=function () {
   if (sndplayed < 4) {
     _rootsndBg.start();
   } else {
   //fade out
   this.onEnterFrame = function () {
     _root.sndBg.setVolume(_root.getVolume() - 2);
     if (_root.getVolume <= 0 ) {
        _root.sndBg.stop();
        this.onEnterFrame = null;
     }
   }
}

//frame X with the ball drop again
if(_root.sndplayed < 4 )  { //plays 3 times
   sndFx.start();
}

//frame X + N
gotoAndPlay(2); // <- don't play 1 again



repeat for each tricks ...

try and see if this help

cheers
0
 
encosionAuthor Commented:
thank you ..henryww : at a glance this looks like the solution ..thank you very much ..i'll put it together and play around until i get it working ..i'll be back to let you all know how it turned out and to 'award the points to the winner!' ..heheh ..thanks again... .. .
0
 
encosionAuthor Commented:
thank you very much ..however there is an unfortunate side effect to this solution : actionscript doesn't really allow you to set in, out and envelope points which is what i was using to recycle some of my sounds without sound the same ..so unfortunately i can't use this technique in my presentation.... .. . the soundoffet value is pretty useless too as it will only accept whole numbers which are far from precise ..does anyone ever even use this function .[?]..
0
 
henrywwCommented:
yeah, the offset only works for whole number (sec)
hmmm ... but i don't quite understand how u recycle the sound ...

0
 
encosionAuthor Commented:
what i mean is i can get more mileage out of an individual sound clip by using it several times with different in, out and envelope points for each instance ..for example the sound of a ball bouncing can be used twice for two different sound effects ..one without any adjustments to reprasent the sound effect of a ball bouncing ..and another instance can reprasent the sound of the ball when it stops ..or lands on something hard { by tweaking the in, out and envelope points }... .. .
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now