Stopping audio

I am loading external swfs, each with unique audio.  As a user selects one of four buttons, the existing swf, both visual and audio) should stop and the selected is to start.  There is a default swf that starts when the flv is initially loaded.  When I start the flv, everything functions correctly.  Then, when I click on a different button, the first swf disappears and goes silent.  Again, this is what should happen.
The problem is after a few second (30-40) and as the second swf is playing, the first one starts back up.  I also noticed that if I double click any of the buttons, I get immediate dual audio.  The AS3 I am using is the following.
Any assistance is greatly appreciated.
import flash.display.*;
import flash.net.*;
import flash.events.*;
import flash.media.SoundMixer;
// track previous and current pages
var curr:MovieClip;
var prev:MovieClip;
// "buttons" are MovieClips, not Button symbols!
// Never use Button Symbols for non-linear navigation systems.
var array:Array = [{button:prog_btn, page:"progression.swf"},
                   {button:elem_btn, page:"elementary.swf"},
                   {button:ms_btn, page:"middleschool.swf"},
                   {button:hs_btn, page:"highschool.swf"}];
// load initial SWF
          var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    //Modify the SWF below to the SWF that is to be played upon starting the WBL
    l.load(new URLRequest("progression.swf"));
// initialize buttons
for each (var obj in array)
    var b:MovieClip = obj.button as MovieClip;
    b.page = obj.page;
    b.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void
    // load the swf file refenced by the button.page property
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    l.load(new URLRequest(e.currentTarget.page));
function swfLoaded(e:Event):void
    // assign the loaded swf to the curr variable
    curr = e.target.content as MovieClip;
    curr.y = 100;
    addChild(curr);
          // if prev is valid, remove it
    if (prev)
    //prev.gotoAndStop(1); comment out by smh to eliminate dup audio
          removeChild(prev);
          SoundMixer.stopAll();
    // assign curr to prev, so the process can run again for the next click event
    prev = curr;

Thank you for the feedback.
I modified the section of code where I do the initial .swf load to declare a new variable to the following:
// load initial SWF
var initial:Loader = new Loader();
    initial.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    //Modify the SWF below to the SWF that is to be played upon starting the WBL
    initial.load(new URLRequest("progression.swf"));
I then added the unloadAndStop() line of code in the onClick function to initiate prior to loadiung the next .swf:
function onClick(e:MouseEvent):void
    // load the swf file refenced by the button.page property
    var l:Loader = new Loader();
    initial.unloadAndStop();
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    l.load(new URLRequest(e.currentTarget.page));
I am still having the same issue.
Steve

Similar Messages

  • Flash CS3 Play/Stop audio button problem

    I made a play/stop audio button with this youtube tutorial (youtube.com/watch?v=XU6oMEFUFF8) but after the sound is finished I want the play button to show up agian.
    Here is the actionscript:
    import flash.events.MouseEvent;
    play_btn.addEventListener(MouseEvent.CLICK,clickha ndler);
    stop_btn.addEventListener(MouseEvent.CLICK,clickha ndler);
    function clickhandler(event:MouseEvent):void{
    swapChildren(play_btn,stop_btn);
    what code should I add to my current code?
    I also can send you the Fla.

    You should consider using the Sound class. Here's a quick overview of it:
    http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d21.html
    You'll be able to add event listeners to the sound to know when it completes so you can execute more code, such as swapping the play and stop button. There is an example in that overview of listening for the SOUND_COMPLETE event (e.g. channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);). It should contain everything you need.
    A basic example of what you'll end up with (there's many ways to do it) might look something like this:
    // just set up and wait for click
    var isPlaying:Boolean = false;
    var mySound:Sound = new MySoundInLibrary();
    var myChannel:SoundChannel = new SoundChannel();
    myChannel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
    // buttons
    play_btn.addEventListener(MouseEvent.CLICK,clickhandler);
    stop_btn.addEventListener(MouseEvent.CLICK,clickhandler);
    function clickhandler(event:MouseEvent):void
              swapChildren(play_btn, stop_btn);
              if (isPlaying)
                        isPlaying = false;
                        myChannel.stop();
              else
                        isPlaying = true;
                        myChannel = mySound.play();
    function onPlaybackComplete(e:Event):void
              isPlaying = false;
              swapChildren(play_btn, stop_btn);
    The basic idea is keeping a flag if the audio is currently playing. If it isn't then assign the sound to a channel and play it while setting the flag (isPlaying) to true. If it's already playing, set the flag to false and stop playing the audio.
    The swapChildren is run in the onPlaybackComplete() method so when the audio completes the play button is swapped back in front.
    Rather than swapping the children I'd urge you to toggle the .visible property instead. It's easy to run commands in the wrong order and get desynched on depth.

  • Stop audio in Captivate 6

    I have an audio file attached to a slide which, after it plays, I leave the slide, but come back to it later. But I don't want the audio file to play upon slide revisit. Is there any way to stop the audio once I come back to the slide?

    Hello,
    I have been answering this several times in the forum, but know the search is not working too well.
    You cannot use slide audio in this case, because the only way to stop that from playing is to mute all audio.
    If you use an 'invisible' object to attach the audio (like a shape with no fill nor stroke) you can stop audio from playing by hiding that object (call such an object an audio object). You will need a user variable, a toggle (will label it v£_visib) that you toggle to 1 from its default 0 when visiting the slide. If it is 1 you hide the audio object.
    I think you'll find information about the work flow in this blog post: http://blog.lilybiri.com/audio-objects-control-them
    Lilybiri

  • Stopping audio after continue button

    I am trying to stop an audio clip after a continue button is clicked. I added the audio to the button and tried to use the STOP AUDIO WHEN CLICKED button is checked. When I preview it though, the audio does not stop and continues to run for the entire slide. I want to audio to only play while that caption is up and the continue button is not selected.
    For example, I am trying to read a caption box that I have made. I want the user to be able to click continue and see the next caption box which then starts the next reading of the next caption box. Any ideas?
    I am use captivate 4, thanks.

    Hi there
    Place the next caption on a new slide. Then configure the button so the action is to go to the next slide. The audio should be skipped over and the next slide audio should play.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • My quicktime player has stopped audio recording. Any suggestions what I can do?

    my quicktime player has stopped audio recording. Any suggestions what I can do?

    Have you tried restarting or resetting your iPhone?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after the iPhone shuts down, then press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds). Ignore the "Slide to power off"

  • AS3 stopping audio streaming inside a layer

    Sometimes I get ahead of myself and have to stop and say how the hell did I do this before? I'm referring to a simple stop button I need to put in a flash animation. I know how to code calling a sound from the library, starting and stopping. But how do I stop audio that is streaming inside a layer from a button ?
    var my_sound:Sound = new Sound();
    my_sound.load(new URLRequest("yoursoundfile.mp3"));
    var my_channel:SoundChannel = new SoundChannel();
    //2.
    play_btn.addEventListener(MouseEvent.CLICK, playSound);
    stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
    //3.
    function playSound(event:MouseEvent):void{
    my_channel = my_sound.play();
    //4.
    function stopSound(event:MouseEvent):void{
    my_channel.stop();

    OK what I actually need is a mute and play button for the audio track
    So how can I stop, or in this case mute the audio without stopping the animation, follow?
    example, volume is at 100
    click button volume goes to 0
    click same button or another button volume goes back to 100

  • ATV3 - I need to enable dolby digital for optical surround sound (netflix and home movies), but when I do this it stops audio coming through TV speakers

    I have a cinema sound receiver connected to Apple TV via optical cable.  When I have dolby digital set to Auto it doesn't come through as dolby digital when watching movies on netflix and iTunes (home movies).
    If I set Dolby Digital to ON it works as expected, but the sound stops working through normal TV speakers (via HDMI).  This is the same for netflix and home movies.
    I tried 16 bit setting, but it made no difference.
    Any advice on how I can get this working - meaning Dolby Digital always on for when I turn my surround sound on and sound through speakers for normal operation?
    Obviously I can change the setting when needed, its just a pain.
    Thanks in advance.

    Hello everyone, 
    here is the friendly and signed driver installation method to enable Dolby Digital Plus in your Encore internal speakers only. This is not an official driver, there is no control panel for Dolby Digital Plus or various sound effects, but tested and has much better and richer surround sound quality as before with factory driver. I guess, this driver tweak can work with any Bay Trail tablet also.
    How can you upgrade Encore sound drivers:
    1. Download signed driver package and extract.
    2. Open Device Manager.
    3. Upgrade your Sound, Video and game controllers
    - Intel SST Audio Device
    - Realtek I2S Audio Codec
    one by one with "Have a disk" method.
    4. Double click enabledolby.reg file and add to your registry.
    5. Restart, and enjoy better sound quality.
    Thanks.
    UPDATE: Official Toshiba Dolby Digital leaked, official driver attached: ToshibaDolby.zip
    - Encore with WimBoot -
    Attachments:
    EncoreDolby.zip ‏310 KB
    ToshibaDolby.zip ‏1310 KB

  • Having stopped audio with a swf inside a sidelet can someone create a swf that will resume the audio

    Ok, rick is going to post the fla of this file and I will
    post the swf. Basically this is all about having a slide that has
    audio running all the way through and enabling the user to roll
    over a sidelet and have the video and audio stop playback.
    At present, the max you can achieve is, to stop video. The
    audio keeps going and of course everything gets out of
    sync. Rick has create a swf that you input into a sidelet (
    after having imported your image or video ) which stops the audio.
    Fantasitc. Unfortunatly he was not successful in creating a swf
    that will resume the audio.
    So there is the mission. To create something that will resume
    the audio, be it a swf inside the sidelet or something else.

    Hi there paul. Am I right in thinking that your code will
    mute the audio. In my situation this would cause problems becasue
    you would roll over the sidelet - the audio would go silent and
    when you rolled off, or resumed the audio, it would have been
    playing so again the video and audio will be out of sync.
    Rick - rather than another swf which would activate the audio
    and video when you roll off the sidelet ( while that is the perfect
    solution ) what about looking at a button the user can press to
    resume things, maybe Im wrong but that sounds a little easier.
    ( however for all those reading this that is not really the
    solution I am looking for, what Im looking for is the above
    solution where you can just roll off and on and so on )

  • EMBEDED SWF VIDEO CANT STOP AUDIO

    Ok. So I am using a flash template that I have altered quite
    a lot. It has video thumbnails with a preloader at the beginning.
    The preloader at the beginning was slow though so I wanted to put
    my general demo reel so it would play while it was loading but stop
    when the site was loaded (that way people could have something to
    look at). I have it so it hides ok. However, it continues to play
    the rest of the videos audio. I need this to stop, but I have tried
    just about everything. I know it is probably something stupid I am
    doing, but if someone could give me a hand I would appreciate it. I
    am half bald at the moment!
    My Website
    Here is the Action Script (3.0) I have for the site (without
    any attempts to shut off the audio since I can't seem to do it
    right anyways). Anyways the video is embedded in cover_mc.

    Try this  SoundMixer.stopAll(); on load complete.

  • Playing, Pausing, Stopping Audio in a Timeline

    I don't use Flash that much so the question may sound simple, but how do I pause audio in a timeline?  I have added the audio, play and stop button.  When I test it works fine, but I can't figure out how to add the pause button, or the play/pause button.
    Thanks.

    Set the audio options on "stream" for the timeline. Then - a blank keyframe would do just fine. When you need the audio on, put it again and adjust the start point in the properties panel.
    Emil Georgiev - Flash and Web Design

  • Button Widget stops audio

    I'm using the button widget in Captivate 5, which is great. Except that it causes the slide audio to stop about 6.5 seconds into a slide - as though the slide becomes Inactive. I can't find a way to change this. Does anyone have a suggestion?

    Hi Lieve,
    Regarding your first concerns : For the static button widget we didn't want to make it to pause the slide at any time. This would behave just like any other static captivate object though we could have actions associated with it which would get triggered on clicking this. However you could enter a feature request whereby this widget pause time could be set as a parameter(in the Widget Properties dialog) which would make it pause at that time for user to click.This would be helpful when this widget is inserted on Question slides. Pausing at 6.5 secs is a bit misleading so this property was removed from the Widget.
    Regarding the second concern : The second widget is just the interactive version of the same static widget which would have the additional 2 properties :
    1.Pause for user interactions
    2.We would get the success/failure/hint captions accordingly when clicked inside/outside the button widget.
    However since we have actions which could be set from the widget properties dialog itself , we need to set it there in order for the appropriate action to get triggered.
    These widgets have been created so that the user can place buttons with different themes/colors/look and feel in his/her project as per their requirements.
    Thanks and regards,
    Sudeshna Sarkar

  • Stopping audio of netstream from outside a movie clip

    I have a netstream from media server defined within a movie
    clip symbol which is playing an audio. I need to stop this audio
    from outside the movie clip symbol when a button is pressed.
    I have tried to close the movie clip, but the audio keeps on
    playing.
    Any idea on how this can be done?
    Thanks in advance

    Found to be an issue with 2 buttons with same name.

  • Stopping Audio in movie within movie..?

    hello,
    If I create a captivate movie called XYZ, (series of slides,
    and/or full motion capture) add narration to it, publish it to swf
    format, and then create a new captivate movie called ABC which uses
    that swf on one of it's slides (i.e. a movie within a movie), how
    do I create buttons in ABC which will stop the audio of XYZ in case
    the learner wants to go to the next slide before XYZ finishes???
    Also, why does a wav file created in Audacity, and
    normalized, sound distorted in captivate? Is there a way around it,
    besides lowering the volume of my Audacity wav file?
    thank you
    Mike

    Mike said . . .
    quote:
    ... how do I create buttons in ABC which will stop the audio of
    XYZ?
    You don't. You create controls for movie XYZ
    within movie XYZ.
    quote:
    ... why does a wav file created in Audacity, and normalized,
    sound distorted in captivate?
    It doesn't - at least on all machines. Perhaps
    you are seeing the problem because of the file-format you are
    saving to (in Audacity). Can you describe what you mean by "sound
    distorted"? Your reference to lowering the volume indicates it is
    not necessarily being distorted, but being amplified excessively
    after import to Captivate . . .
    If that is the case, it seems to me that the simplest
    solution is exactly what you already suggested - lower the
    amplitude in Audacity . . .

  • Stopping audio in an interaction

    I have an interaction with audio narration added to the buttons of the interaction. Is there a command to manually stop the audio from playing that I can assign to a button or do users have to wait until the audio stops?

    Button can only mute. I don't know of a way to control audio attached to interaction buttons.  With audio objects or with the Play audio command (stop triggered audio) that is possible, but not aware of a work flow for interaction audio.

  • Button to stop audio

    I have a PDF with an audio file that automatically starts playing as soon as the PDF opens. I would like to add a button that users can click to stop playing the audio. However, the only action I see that is related to audio is to PLAY audio.
    Can anyone help to explain how to create a button that STOPS the audio from playing?

    rowby wrote:
    > Hello!
    >
    > I have a movie with 4 separate audio buttons set as
    "Start/Repeat 0".
    >
    > I want the web visitor to be able to hit a "stop" button
    to stop the playing
    > of the audio. The audio "stop" button would be next to
    the play button.
    > Alternatively there could be ONE button in the movie
    that woud stop ANY audio
    > that is playing.
    >
    Make a movie clip, frame 1 with sound set to EVENT and number
    of loops you want
    and a stop(); action.
    Frame 2 of that movie clip the very same sound set to STOP
    and loop to 0 (zero)
    Now all you need is a button in frame 1 OFF The Sound with
    action nextFrame();
    and on second frame button with an action to ON the button
    using prevFrame();
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

Maybe you are looking for

  • HP Deskjet 712c Win 7 Home problem connecting to shared printer on Win XP Pro PC

    Hi, I am having a problem connecting to a shared printer on my home wireless network. The printer is HP Deskjet 712C. When I had Win XP on all my PCs, I could successfully share the printer from one PC and print to it from any PC. Worked just fine. H

  • How to transfer notes from ipad to ipad

    I have an iPad 1 and I have information typed up in my notes there.  Just recently I purchased the iPad 3, and I would like to transfer all the notes I had from my old iPad to the new one.  I tried just "transfer purchases" on the old iPad first, it

  • Server communicaton error with the distribution wizard in BPC 7.0?

    Does anyone have experience or a solution for the email error message when using the distribution wizard?The wizard processes the report and then asks for a system password. We don't know what that password is, does this feature require a special pas

  • How to install a tcl file.

    I am using a corpus and installing the software has been a pain. I have unzipped a compressed file and sent it to a location on the C drive. The instructions tell me that I need to hit the install.tcl folder. When I do I get an error message from Rea

  • Runtime.exec error on Fedora Core

    Hi, I have some difficulty using Runtime.exec method on Fedora Core. If classpath contains "space", it cannot execute a commnad. It works well on Windows systems with quotation marks. Here's my code. Proccess p = r.exec("java -classpath .:\"pkg root"