[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swftools-common] stop long sound

From: Matthew Morgan
Subject: Re: [Swftools-common] stop long sound
Date: Tue, 24 Nov 2009 08:26:56 -0500
User-agent: Thunderbird (X11/20090817)

Chris Pugh wrote:
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

Try giving this a quick read..




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

       .sprite ekgFlatLineSprite
               .put ekgFlatLine x=0 y=55
               .play flatLineBeep loop=-1 nomultiple

       videoStage = 0;
       keyListener = new Object();
       keyListener.onKeyDown = function(){
           if(videoStage == 0)
               _root.attachMovie("ekgFlatLineSprite", "ekgFlatLineMovie",
           }else if(videoStage == 1)




Thanks to a little lesson from Chris, I figured out what I needed to do. The basic gist of it is:

.sound someSound "mySound.wav"

Gets declared directly under the .flash container somewhere. Then, in an actionscript block the following is needed:

soundObj = new Sound();
soundObj.start(0, 0); //first parameter lets you start n seconds from the beginning of the sound, second parameter tells how many times to loop

After that, I can control it as needed.

*“* When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." *”*

-Linus Torvalds

reply via email to

[Prev in Thread] Current Thread [Next in Thread]