开发者

How do I mute and un-mute multiple embedded audio tracks in flash (actionscript 3)

开发者 https://www.devze.com 2023-03-21 05:38 出处:网络
I have a file with one main mc called \"clip\" that contains 9 different embedded audio tracks (all inside their own separate mc) on the first keyframe. They span the entire length of the mc - 10 f开发

I have a file with one main mc called "clip" that contains 9 different embedded audio tracks (all inside their own separate mc) on the first keyframe. They span the entire length of the mc - 10 f开发者_StackOverflow中文版rames in this case.

Essentially what this does is creates a full song with 9 separate tracks that I want to mute (and unmute) when I arrive at a specific keyframe.

I am using a slider (called "aSlider") on the main timeline to navigate between the keyframes.

Everything starts out muted and as we progress, tracks are unmuted and the song starts to build. It is working great right now in that direction. However, if I move the slider backwards, it seems to be re-creating the audio clips so that I am overlaying more and more audio on top of each other.. which is quite the mess.

Here's the AS for the slider.

aSlider.width = 324;
aSlider.move(309, 681); 

addChild(aSlider); 

trace(mc.totalFrames);

aSlider.maximum = mc.totalFrames;
aSlider.liveDragging=true;
aSlider.addEventListener(Event.CHANGE,mcHandler);


function mcHandler(e:Event){
    mc.frameTxt.text = aSlider.value;
    trace("aSlider.value: "+aSlider.value);
    mc.gotoAndStop(aSlider.value);
}

And here's the AS for each individual frame inside the main mc.

stop();
piano.volume=.5;
trackPiano.soundTransform=piano;
violin.volume=.5;
trackViolin.soundTransform=violin;
cello.volume=.5;
trackCello.soundTransform=cello;
drums.volume=0;
trackDrums.soundTransform=drums;
bass.volume=0;
trackBass.soundTransform=bass;
electro.volume=0;
trackElectro.soundTransform=electro;
voice.volume=0;
trackVoice.soundTransform=voice;
synth.volume=0;
trackSynth.soundTransform=synth;
guitarra.volume=0;
trackGuitarra.soundTransform=guitarra;

ANY help on how I can keep the tracks from duplicating on top of themselves would be GREATLY appreciated. Thanks so much!


Can you show a screen capture of the timeline?

You say that you have keyframes. Are these defined in a separate layer, or do you have those same keyframes defined at each layer? This will, indeed, cause a new instance of each sound when the keyframe is encountered--but I would expect it to happen both forward and backward.

HTH;

Amy

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号