Skip to main content
Known Participant
August 19, 2011
Answered

Mute sound on timeline

  • August 19, 2011
  • 1 reply
  • 1004 views

We have a movie clip containing a set of sound files.  All sound is on the timeline.   We have tried the following, but none works.  Can anyone help?  Thanks!

[ on the frame where the sound starts]

if (deactivate) {

   SoundMixer.stopAll();

}

or

[ first frame of movie clip]

var sndTransform:SoundTransform = new SoundTransform();

SoundMixer.soundTransform = sndTransform;

[ on the frame where the sound starts ]

if (deactivate) {

    sndTransform.volume = 0;

} else {

    sndTransform.volume = 1;

}

This topic has been closed for replies.
Correct answer kglad

you movieclip has a soundTransform property you can use:

// if your code is on the parent timeline:

var st:SoundTransform=mc.soundTransform;

if(deactivate){

st.volume=0;

} else {

st.volume=1;

}

mc.soundTransform=st;

// if your code is on the movieclip's timeline, use "this" instead of mc

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 19, 2011

you movieclip has a soundTransform property you can use:

// if your code is on the parent timeline:

var st:SoundTransform=mc.soundTransform;

if(deactivate){

st.volume=0;

} else {

st.volume=1;

}

mc.soundTransform=st;

// if your code is on the movieclip's timeline, use "this" instead of mc

aimaobAuthor
Known Participant
August 19, 2011

Yes, it works!  Thank you!

kglad
Community Expert
Community Expert
August 19, 2011

you're welcome.