swftools-common
[Top][All Lists]
Advanced

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

[Swftools-common] stop long sound


From: Matthew Morgan
Subject: [Swftools-common] stop long sound
Date: Thu, 19 Nov 2009 08:19:12 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

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

reply via email to

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