[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swftools-common] stop long sound
From: |
Chris Pugh |
Subject: |
Re: [Swftools-common] stop long sound |
Date: |
Sat, 21 Nov 2009 07:05:04 +0000 |
Because the sounds are triggered in your sprites, and are thus local
to your sprites, and not to the main movie?
As a result all you are doing is overlayering the same sounds on top
of one another, raher than actually stopping
them.
Try giving this a quick read..
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundMixer.html
HTH.
Regards,
Chris.
2009/11/19 Matthew Morgan <address@hidden>:
> I created an animation that is supposed to simulate an ekg. It's not the
> best, but it's just for a little church play so it doesn't have to be. It
> starts out with a normal pattern and beeps at every crest. On key press, it
> goes to a flat line. After another keypress, it's supposed to stop.
>
> I created the sound for the flat line by using Audacity to generate a sine
> wave. I tried making it short and looping it, but this makes an annoying
> pulse at every loop iteration. To fix that, I just made the sound
> longer...60 seconds I think. The problem is, I can't get it to stop. I've
> tried stopAllSounds(), flash.media.SoundMixer.stopAll(), and several other
> things I found on the net, but it just won't work. The image goes away just
> like it should after a call to movie.unloadMovie(), but no matter what sound
> stop command I've tried the sound continues to play.
>
> What's the prescribed way for doing this? I've attached the .sc file so you
> can see what I'm doing.
>
> .flash filename="ekg.swf" bbox=327x127 fps=60
>
> .png ekgLine "ekg_line.png"
> .png ekgMask "ekg_mask.png"
> .png ekgFlatLine "ekg_flat_line.png"
>
> .sound ekgBeep "beep.wav"
> .sound flatLineBeep "flat_line.wav"
>
> .sprite ekgGoodSprite
> .put line1=ekgLine x=0 y=0
> .put line2=ekgLine x=109 y=0
> .put line3=ekgLine x=218 y=0
> .put ekgMask x=0 y=0
> .frame 50
> .change ekgMask x=24
> .play ekgBeep
> .frame 250
> .change ekgMask x=140
> .play ekgBeep
> .frame 430
> .play ekgBeep
> .frame 550
> .change ekgMask x=317
> .end
>
> .sprite ekgFlatLineSprite
> .put ekgFlatLine x=0 y=55
> .play flatLineBeep loop=-1 nomultiple
> .end
>
>
> .action:
> _root.attachMovie("ekgGoodSprite","ekgGoodMovie",2);
> videoStage = 0;
> keyListener = new Object();
> keyListener.onKeyDown = function(){
> if(videoStage == 0)
> {
> ekgGoodMovie.unloadMovie();
> _root.attachMovie("ekgFlatLineSprite", "ekgFlatLineMovie",
> 2);
> videoStage++;
> }else if(videoStage == 1)
> {
> flash.media.SoundMixer.stopAll();
> ekgFlatLineMovie.unloadMovie();
> videoStage++;
> }
> };
>
> Key.addListener(keyListener);
>
> .end
>
> .end
>
>