Prevent audio files overlapping

I am developing an eLearning module in Flash CS5 using Actionscript 3.
On most frames an audio file plays, and then the timeline moves to the next frame.
In the background of each frame are four buttons where a user can click to jump to a different section of the course.
The problem I am having is that sometimes when a user clicks to jump to a different section, the timeline jumps; but then after a short delay the timeframes starts jumping between the old frame and the new frame and playing both audio clips.  I suspect this problem is only occurring if the audio file has not fully loaded when the user clicks the button; but this is my first time using audio in Flash so I could be completely wrong.
What I would like to do is change the code so that when a user clicks a button to jump somewhere else, the code says stop loading audio and stop playing any audio, and then jump to the new frame. 
Here is the relevant sections of the code I have on layer 1, frame 1:
import flash.media.SoundMixer;
// Event listeners
mcWhenLarge.addEventListener(MouseEvent.CLICK, When);
mcWhatLarge.addEventListener(MouseEvent.CLICK, What);
// Event handlers
function When(event:MouseEvent):void
      flash.media.SoundMixer.stopAll();
     gotoAndPlay(7):
function What(event:MouseEvent):void
      gotoAndPlay(2);
      flash.media.SoundMixer.stopAll();
Layer 1 of most subsequent frames looks like this:
mcWhen1.addEventListener(MouseEvent.CLICK, When);
mcWhen1.buttonMode = true;
And then Layer 2 of most frames looks something like this:
import flash.net.URLRequest;
import flash.media.Sound;
import flash.events.Event;
var soundReq1:URLRequest = new URLRequest("Recording1.mp3");
var sound1:Sound = new Sound();
sound1.load(soundReq1);
sound1.addEventListener(Event.COMPLETE, onComplete1);
function onComplete1(event:Event):void
      sound1.play();
     setTimeout(gotoAndStop, 2000, 3);
Any help you can give me to stop this bug would be greatly appreciated.
M Hetherington

Thanks for that Ned.  I have changed the button statements to gotoAndStop() rather than gotoAndPlay.
So I'm hoping to do now is have one layer that has a single set of actions with a channel that will control all the sounds.  I can't get it to work the way I want though.  Here's what I've got:
// first I do a different variable for each sound file
var soundReq1:URLRequest = new URLRequest("Recording1.mp3");
var soundReq2:URLRequest = new URLRequest("Recording2.mp3");
// then I have the variables for the sound and the channel
var sound:Sound = new Sound ();
var soundControl:SoundChannel = new SoundChannel();
// then I tried to use entering a new frame to trigger a function to pick the right sound file
this.addEventListener(Event.ENTER_FRAME), whichSound);
function whichSound(event:Event):void
     if(this.currentFrame == 2){
          trace ("I found frame 2");
          sound.load(soundReq1);
          sound.play();
          setTimeout(gotoAndStop, 2000, 3);
     else if(this.currentFrame == 3){ 
          trace ("I found frame 3");
          sound.load(soundReq2);
          sound.play();
          setTimeout(gotoAndStop, 2000, 3);
It seems to be playing the audio; but I'm getting lots of "Error #2037: Functions called in incorrect sequence, or eariler call was unsuccessful" errors related to flash.media::Sound/_load().
Thanks in advance
M Hetherington

Similar Messages

  • Corrupt audio file prevents me from opening Logic project file

    Hello,
    I've been running Logic 8 for a couple years off my MacBook and have never encountered any significant problems of file corruption until recently.
    The issue I encountered is this:
    I've been producing a lengthy track in an on-going Logic project file for some time and after completing a recording session I saved and started deleting excess track copies to clean up my arrange window. Upon doing so Logic unexpectedly crashed.
    After attempting to reopen the project file, it started its normal process of loading its respective audio files, but now it hangs on one particular audio file indefinitely (I'll refer to it as 'audio file x' for ease of reference), freezing and crashing Logic as a result. All of this project file's auto backup files are also incapable of being opened without giving me the same result and crashing Logic.
    I have no way of opening this project file and getting at my most recent saved sequence!
    I've tried removing this corrupt 'audio file x' from the project's audio folder and dragging it to the desktop, but this had no effect and I still can't open any recent version of the project file.
    Older saved copies of the current project file do still open though (most likely because they were saved prior to the corruption caused by this suspect 'audio file x.') When opening an earlier iteration of the project, I get a message '1 invalid audio region found' (I assume referring to the corrupt suspect 'audio file x' that I removed to the desktop) but the project file is still able to open.
    I realize I could import the audio files from the most recent version of the crashed file to an older project version and reconstruct things back to the way they were, but it would take me a lot of time and I'm hoping there may be some way to recover the un-openable project file by getting it to stop looking for this corrupted 'audio file x' on startup.
    When I click 'show package contents' of the Logic Project file, I notice two items labeled 'displayState' and 'documentData.' From my troubleshooting I've come to the basic understanding that the 'documentData' file contains all the sequence data and settings for its respective Logic Project file.
    I think the 'document data' of the unopenable project file in question may be corrupt because whenever I replace it with the 'document data' from an earlier Project file version, the file is able to open. This doesn't do me much good though, because it's document data from an earlier iteration of the project and I need to be able to get at the current sequence I had right before my file crashed.
    Is there anyway to open a project file without letting it load its audio files? Or is there anyway I could get inside the 'document data' file to delete the reference/pathway in its audio bin to the corrupt 'audio file x' its hanging on?
    Any insights would be greatly appreciated. I'm hoping there's some way I won't have to repeat a couple days worth of work. Thanks for your help!

    stooby3535 wrote:
    After further troubleshooting I've realized that the suspicious audio file that prevents the project file from opening is actually not corrupted itself. I can still play the audio file in other media software like Quicktime, etc. with no problem.
    This leads me to believe the problem opening the project file lies solely with the corrupted 'documentData' file.
    Does anyone have any ideas about how I could somehow open this project file and delete the reference of the troublesome audio file from the project's audio bin?
    Well... it really sounds like the project itself is corrupted, that's one of the reasons all project files won't load from a certain point on.
    Try this.
    Reboot the Mac.
    Open the Applications folder and boot Logic from it's icon.
    As soon as the Logic Logo/graphic window appears on the screen hold down the control key. You will see a message pop up that says something like "Launch the Core Audio Driver" there will be yes/no choice available... select NO.
    Go to the File menu and selct "open" go find your project file and see if it will open. If it does.. delete the audio file in question... however.. I would also look at any plugins you recently installed and are possibly using in this project...this sounds more like a plugin problem rather than an audio file problem, but that's just a gut feeling.
    Anyway, if it opens delete whatever you suspect and save under a different name.
    Reboot Logic and see if it can load the project.
    pancenter-

  • Overlapping 2 audio files

    Hi,
    I was wondering if there is an easy way to overlap 2 audio files in 1 track; and I want both of them to play at the same time.
    http://img143.imageshack.us/img143/1084/screenshot20100518at843.png
    http://img227.imageshack.us/img227/1084/screenshot20100518at843.png
    At the moment, as soon as the new file starts, the previous one stops.
    Of course if I drag the later audio file to another track, then they both play at the same time, sounds like it's continuing smoothly.
    But there are too many files now... and I don't want to have a huge list of tracks.
    Is there anyway to fix this problem? Pro Tools had something like X automation or something,,,
    Thanks
    S

    Well, basically, you should have 2 tracks (!!!) where you can position your 2 regions where you like them to be. When you hit play, the 2 sounds will play (and they will play together and not disturb each other, because they are on separate audio tracks. Okay?
    Now to combine them, select both regions on the two separate tracks. Press + . Say yes to mixdown. This should work. It certainly does for me.
    Fox

  • How to prevent an audio file to play the second time the users enter the screen?

    Hi there
    I have a request from my client. She wants the audio file I have on one slide not to play again when the users return to that screen. Is it possible to do that using conditions? I searched the forums but couldn't find anything like this.
    I am using Captivate 5.5.
    Thank you in advance.

    I explained that both in workshops for advanced actions and in a presentation (Lectora vs Captivate) at DevLearn. In this blog post an example, with short explanation can be found:
    http://lilybiri.posterous.com/playtime-with-audio-and-widgets
    The idea is to link the audio not to the slide but to an 'invisible' object (I even have a Highlight box style for that). When entering the slide the first time you show the object and audio will play, when entering afterwards it will be hidden again. This implies the use of a user variable to track the first visit, and a conditional action. If you need more info, just ask for it.
    In CP6 another approach would be possible, using the new statements Play audio and Stop Triggered Audio.
    Lilybiri

  • How do I add Core Audio files from my HD to the search tab?

    Hello there,
    I'm trying to add a few core audio files from my hard drive the sound effects library in Sound track. I assumed if I just coppied and pasted the CAF files in the ambience folder that is in the  ilife sound effects folder in my library that the files would automaticaly show up in the search tab in soundtrack. this is not the case.
    Can anybody help me?
    Soundtrack 3.0.1
    Thanks,
    mike

    iTunes/iPod does not provide a way of copying tracks from an iPod to iTunes except for purchased music. But iTunes can play MP3 files without conversion.
    Here are some ways of getting files from an iPod to your PC:
    Copy from iPod to PC
    It is important not to allow your iPod to sync with an empty library. If it is set to synchronise automatically you will get a message saying your iPod is linked to a different library and asking if you want to sync – it is important to press cancel as syncing with an empty library erases all music from your iPod.
    You can also prevent auto sync by holding down shift & ctrl as you plug in your iPod and keeping the keys held down until the iPod appears in iTunes.
    Once you are connected, you need to set your iPod to manage music manually.
    http://support.apple.com/kb/HT1535
    If you have an iPod with iTunes Store purchases on it, you can use it to copy your purchases to other authorized computers.
    http://support.apple.com/kb/HT1848
    However this is not allowed for other music.
    This MacMuse tip tells you how to copy music from your iPod using Windows Explorer, but it is a bit fiddly:
    http://discussions.apple.com/messageview.jspa?messageID=797432
    Otherwise you can use third party software to manage the transfer, there are a variety of programs out there, some free and some that will copy ratings and counts as well as the music files. Here is a selection, check them out and see what suits you.
    http://www.yamipod.com/main/modules/home/
    http://www.floola.com/modules/wiwimod/index.php?page=WiwiHome
    http://www.ipodsoft.com/site/pmwiki.php?n=igadget.Homepage
    http://www.copytrans.net/
    For a more complete list see:
    http://en.wikipedia.org/wiki/Comparisonof_iPodmanagers
    There is a useful background article on copying from your iPod here:
    http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/

  • Playing DJ mixed audio files?

    It seems somehow that when I play downloaded audio files that are a DJ mix compilation, iTunes and my iPod seem to insert a momentary silence between songs when switching to the next song. I know for sure that this is not the case with windows media player. Anybody got a solution for this? It gets annoying because it ruins the transition between songs that are mixed back to back by a DJ...
    Reuben

    iTunes will convert wma to mp3 (or acc) format. Here are the instructions:
    To convert a song's file format:
    Choose iTunes > Preferences, then click the Advanced button at the top of the window and click Importing.
    From the Import Using pop-up menu, choose the encoding format that you want to convert the song to, then click OK to save the settings.
    Select one or more songs in your library, then choose Advanced > Convert Selection to MP3, Convert Selection to AAC, Convert Selection to Apple Lossless, Convert Selection to AIFF, or Convert Selection to WAV. (The menu item changes to show what's selected in your Importing preferences.)
    To convert all the songs in a folder or on a disk, hold down the Option key and choose Advanced > "Convert Selection to," then choose the folder or disk containing the songs you want to convert. All the songs in the folder or on the disk will be converted except songs you purchased from the iTunes Store. (Purchased songs are encoded using a protected AAC format that prevents them from being converted.)
    Glor

  • Slide Action on Exit Cancelled by Length of Audio File

    Captivate 8.0
    Responsive Project
    Status:  Solution to problem works but makes no sense
    Problem:  Slide actions on exit designated in the Properties Inspector do not function.  Although the "jump to slide" action was selected, the transition at the end of the slide moves to the next slide. I encountered this problem as I was developing a series of slides that would supplement a single beginning slide.  Using click boxes I wanted the learner to be able to click on an item, go to a slide with more detail, then return to the original list on the starting slide.  I set the supplemental slides up in the Property Inspector--Actions to "Jump to slide" and selected the beginning slide number.  When I ran the project, the click boxes moved to the correct slides but the supplemental slides did not return to the beginning slide.  They only transitioned to the next slide.   
    Solution:  This makes no sense to me and is the source of my question.  I'm using text-to-speech as a temporary method of making a rough cut at timing while I am waiting on narration files.  The audio files created by text-to-speech usually run to the end of the slide and are exactly the same length as the slide.  Grabbing at straws to fix the problem, I added 0.2 secs to the slide length so the slide timing was slightly more than the audio file.  Voila!  The selected action (jump to slide X) functions as expected.  I made the same change on the balance of seven slides and the entire routine works as designed.  I have not tested slides using imported narration or narration recorded within Captivate to see if the same problem presents. 
    Why would this be?  Why would the length of an audio file prevent an exit action from functioning? 

    Lilybiri answered this on another question discussion 
    "Slide on exit action conflicts with button action in Captivate 5.5"

  • Imported audio files are repeating same audio on objects in a slide

    Hi
    I can't find anything here that mentions the problem I am having.
    I am using Captivate 4. And Neospeechs desktop VoiceText program to record audio files outside of Captivate. They are saved as WAV files, then I import the audio into Captivate.
    I have various objects on a slide. For example, I have six text Rollover Captions. When you roll over them, some text is displayed. I have attached my audio files to these rollover objects. So, I would have audio1.wav, audio2.wav, audio3.wav etc and these play when you roll over the captions.
    The issue I am having, is that when I Publish or Preview the project, sometimes the wrong audio file is playing upon rollover. Usually the first couple of caption/file combinations will work, so I get audio1.wav for caption1 and audio2.wav for caption2, but then say for captions 3,4,5,6 I am still getting audio1.wav playing!
    I have doubled checked everything and the correct audio files are attached to the captions. And they all play correctly in Edit view.
    I've just noticed this has happened again in a different Captivate 4 project, where I have about 6 lines of Text Animation, with an audio file for each text animation. They have been distributed across the timeline so that the text animations do not overlap, and yet I am still hearing imported audio files repeated.
    If anyone can help to shed any light on this, i'd be grateful, as I'm totally stumped!
    thanks
    Lolly

    Have you got the correct selection buttons at the bottom left of the Files panel enabled under Sort by:?

  • How do I stop preloading of HTML5 audio files?

    When I open a page that has audio tags for HTML5, it automatically downloads the files. I never use the in-browser audio player and instead download for offline listening. How do I prevent these files from being downloaded for browser playing since I have to download them a second time for my offline playing?

    Does Firefox play MP3 files in an HTML audio tag on Mac?
    A lot of other types can be disabled via one of the media prefs, but if there isn't one for files that still play and disabling media.autoplay.enabled to false also doesn't help then I don't know what else to try.

  • 8 bit / corrupted audio files on re-opening a song

    See the post below. I'm having this exact problem with the latest version of Logic Pro on my intel mac. Is there a solution for this mentioned somewhere already? Please let me know soon.
    Joshua Brown
    Posts: 7
    Registered: Aug 18, 2005
    "8-bit" Corrupted Audio Files On Reload?
    Posted: Aug 18, 2005 10:45 AM
    A day after a recording session with my band the other night, I re-opened the song and recieved an error message "What kind of file is this?" and then another... something about the file being "8-bit" and unusable. This is the bass track from a very good session with my band and I'd like to try and recover it. Does anyone know how this happened, how to recover the file, and how to prevent it from happening in the future? Any help would be greatly appreciated.
    More info: When opening the file in SoundHack, it says that it is a "Headerless" file. Setting the header to 24 bit linear and saving a copy results in an extremely distorted and unusable file, but you can kind of hear the recording in the background... sped up.

    Hello and thanks to all for your replies. Oh and I did in fact copy somebody else's post. Sorry for the confusion.
    I had a backup of the song on another disk with which I continued with my mixing. I am not worried about that particular song now. I am just worried that this might happen again.
    About my sound/sample library, I just deleted the folders which had corrupted files and copied back from my backup disks.
    Dropping corrupted file in a new .lso doesn't work. Haven't tried moving preferences yet but will do. I didn't have a mac before I bought an intel mac.
    Can someone explain why this happened in the newest version when this was supposed to have been resolved in an earlier version? Isn't the latest version a cumulative one?
    There's one other thing that also happened with me this week. I think it's related:
    I had a Logic project open which was set at 96/24 and I had some audio done in it. I tried to open Reason rewired to Logic because I wanted a drum beat from Dr.Rex. Reason was set at 44/16. I tried to open some of the samples from my sound library. The files played just fine but later on when I checked, the folders which I went into looking for that drum beat got corrupted. In fact, it corrupted everything under root folder. It shouldn't have touched my samples at all, right? Why should this happen when I'm trying to just read samples or files?

  • How do I move MPEG audio files from my iPod to my library on my computer???

    Can someone tell me how to move MPEG audio files from my iPod to my library on my computer? Somehow all my songs on my iPod are MPEGs and they won't transfer to the library. I really don't want to loose the music, and there doesn't appear to be an option to convert the MPEG to a ACC file while the MPEG is on the iPod. Please help....

    iTunes/iPod does not provide a way of copying tracks from an iPod to iTunes except for purchased music. But iTunes can play MP3 files without conversion.
    Here are some ways of getting files from an iPod to your PC:
    Copy from iPod to PC
    It is important not to allow your iPod to sync with an empty library. If it is set to synchronise automatically you will get a message saying your iPod is linked to a different library and asking if you want to sync – it is important to press cancel as syncing with an empty library erases all music from your iPod.
    You can also prevent auto sync by holding down shift & ctrl as you plug in your iPod and keeping the keys held down until the iPod appears in iTunes.
    Once you are connected, you need to set your iPod to manage music manually.
    http://support.apple.com/kb/HT1535
    If you have an iPod with iTunes Store purchases on it, you can use it to copy your purchases to other authorized computers.
    http://support.apple.com/kb/HT1848
    However this is not allowed for other music.
    This MacMuse tip tells you how to copy music from your iPod using Windows Explorer, but it is a bit fiddly:
    http://discussions.apple.com/messageview.jspa?messageID=797432
    Otherwise you can use third party software to manage the transfer, there are a variety of programs out there, some free and some that will copy ratings and counts as well as the music files. Here is a selection, check them out and see what suits you.
    http://www.yamipod.com/main/modules/home/
    http://www.floola.com/modules/wiwimod/index.php?page=WiwiHome
    http://www.ipodsoft.com/site/pmwiki.php?n=igadget.Homepage
    http://www.copytrans.net/
    For a more complete list see:
    http://en.wikipedia.org/wiki/Comparisonof_iPodmanagers
    There is a useful background article on copying from your iPod here:
    http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/

  • Prevent Downloading files

    hi to all,
    i am creating one online tutorial portal using jsp and servlets in the MVC pattern.I have the voice file repository in which user can ear the voice files(wav,mp3) randomly and attend the test.The problem is when i open the browser the other parties software like download manger which downloads the voice file ,is there any way to prevent downloading or encrypt the source of the audio files.
    thanks in advance

    You cannot prevent downloading. If you do it, no one can get your files. I think you rather want to block download managers and accelerators.
    You can prevent a big part of them by writing a Filter which sniffs the user-agent header of the request and checks it against a blacklist and if needed redirect it to a warning page such as "No download managers allowrd. Please disable your download manager." or so. You can find the user-agent strings of the most known download managers on the web, for example here: http://www.user-agents.org CTRL+F on "download".
    Keep in mind that the client has full control over what it sends along the request, so it could also spoof the user-agent string. You can't do anything against this. At least my suggestion will cover the biggest part of the requests.

  • Mail: Can't drag audio files

    Does anyone know how you can drag audio files from mail to anything else?
    You used to be able to just drag the file to for instance another mail, but now I can't "grab" the file.
    Best
    Greiffenberg

    Do you mean that you are trying to drag the tunes into the main iTunes window or to the main desk top?
    Are these from an audio CD or previously ripped mp3/mp4?
    Is it possible that you have removed your "ownership and permissions" privileges from a particular folder and it is now locked preventing you from changing that folder?
    MJ

  • How do I prevent audio clicks at the borders of cut audio regions?

    There must be a simple automated way to prevent this without editing each audo file individually. I tried selecting the regions and setting up fade in/out or crossfade in the inspector, but that does not seem to do it. When I edit the audio file in the editor, the audio click goes away, but this takes too much time.

    Crossfade didn't seem to help, but selecting the regions and setting the fade in and fade out in the inspector to as little as 2(msec?) seems to get rid of the pops. Thanks!

  • How do I move the visual voicemail audio files to my computer (OSX10.4.11)?

    I have an excellent voicemail that I'd like to download to my computer. Obviously, these are stored as audio files on the iPhone, but I don't know how to move, retrieve, download them to my machine. Does anyone know how to do this? If so, I'll post the greatest voicemail ever received by accident. Thank you!

    No offense to Jose, but he is wrong (for iPhones; old school voicemail is indeed stored on AT&T's system). You can verify this by putting your phone in Airplane Mode, which will prevent it from accessing any server, AT&T or otherwise, and listening to all the Visual Voicemail messages stored on your phone.
    So it is theoretically possible to find them and copy them, but unfortunately I have not seen anyone figure this out ... yet.
    -dan

Maybe you are looking for