Playing random sound in array

Hey guys,
I'm new to AS3, still learning. I just read a little about arrays in the book I was learning from, and after looking at some online stuff, thought I'd try to do something simple with one.
What I'm trying to do is save a bunch of sounds (different dog barks) in an array and then when I press the button, it plays a random sound from that array. Here's what I have so far :
package
          import flash.media.Sound;
          import flash.media.SoundChannel;
          import flash.events.MouseEvent;
          import flash.display.MovieClip;
          public class Sound2 extends MovieClip
                    var bark1:Bark1;
                    var bark2:Bark2;
                    var bark3:Bark3;
                    var bark4:Bark4;
                    var bark5:Bark5;
                    var bark6:Bark6;
                    var soundChannel:SoundChannel;
                    var barkArray:Array = [Bark1, Bark2, Bark3, Bark4, Bark5, Bark6];
                    public function Sound2()
                              barkButton.addEventListener(MouseEvent.CLICK, onBarkButtonClick);
                              bark1 = new Bark1();
                              bark2 = new Bark2();
                              bark3 = new Bark3();
                              bark4 = new Bark4();
                              bark5 = new Bark5();
                              bark6 = new Bark6();
                              soundChannel = new SoundChannel();
                              function onBarkButtonClick(event:MouseEvent):void
                                        var barkNo = Math.round(Math.random() * 5);
                                        soundChannel = (barkArray[barkNo]).play();
When I try to press the button, I get this error message :
TypeError: Error #1006: play is not a function.
          at MethodInfo-22()
I used trace and saw the numbers from barkNo were fine, I think it's just something about the array. I've also spent a few hours trying to do it different ways, but still nothing. How can I play a random sound from an array? And am I storing the information correctly? I'm not sure what I'm missing, any help would be great.
Thanks

First, never use nested and anonymous functions - you position yourself for a lot of trouble.
Try this (I did not test it though):
package
          import flash.media.Sound;
          import flash.media.SoundChannel;
          import flash.events.MouseEvent;
          import flash.display.MovieClip;
          public class Sound2 extends MovieClip
                    var sound:Sound;
                    var soundChannel:SoundChannel = new SoundChannel();
                    var barkArray:Array = [Bark1, Bark2, Bark3, Bark4, Bark5, Bark6];
                    public function Sound2()
                              barkButton.addEventListener(MouseEvent.CLICK, onBarkButtonClick);
                    private function onBarkButtonClick(event:MouseEvent):void
                              soundChannel.stop();
                              sound = new barkArray[int(barkArray.length * Math.random())]();
                              soundChannel = sound.play();

Similar Messages

  • Macbook Air plays random sounds after plugging in headphones

    Is it just me?
    Every time I plug something into the headphone socket on my 2012 Macbook Air it plays a random series of system sounds - usually alerts and "email whoosh".
    Thanks.
    JC

      Reset PRAM:   http://support.apple.com/kb/PH14222
    Reset SMC.     http://support.apple.com/kb/HT3964
    Choose the appropriate method.
    "Resetting SMC on portables with a battery you should not remove on your own".

  • Random sounds playing from Macbook unprompted

    My Macbook Pro is playing random sounds when it is not being asked to.  Computer on right now, with no music playing and very short snippets of sound (2 seconds at most) are playing out the speakers - trying to identify them they are not parts of songs I have (iTunes is not running right now) but sound like the sonic element of a video that is buffering.  The biggest segment I heard just a few minutes ago where an American lady said quite a few words (sounded like an infomercial).  It's happening maybe every few minutes, but not at regularly timed intervals.
    Sounds sort of like trying to tune a radio and only catching snippets of sound (but less regular)
    Currently running - google chrome, finder and messages.
    Also open Dropbox, Copy, Evernote, f.lux, Gdrive and Twitter apps.
    MacBook Pro (Retina, 13-inch, Late 2013) / Running Yosemite 10.10 (I'm not 100% sure but I think this problem started before Yosemite upgrade)

    HI and Welcome to Apple Discussions...
    Random sounds playing.
    Check your Dashboard widgets. You might have something running ...
    Carolyn

  • Random Sound Array Issue

    Been trying to implement a random sound picker on the main
    timeline. (Keeping in mind it needs to work in AS1)
    All my sounds are correcly identified under the "linkage"
    propreties.
    Somehow, my array value always comes up undefined. And none
    of the sounds would play.
    Help would be greatly appreciated.

    "Detonate 2004" <[email protected]> wrote in
    message news:eaq6n1$pq7$[email protected]..
    > Please forget the last post since my array was still not
    correctly syntaxed.
    >
    > The latest corrective outputs: [object Object],[object
    Object],[object
    > Object],[object Object]
    > And still no sounds.
    >
    > Latest file here:
    >
    http://www.mysharefile.com/v/2899615/1_as1_soundarray.fla.html
    I can't look at the fla because of my old Flash version but I
    looked at your posted code again.
    Do you need all that array stuff for anything? I mean, if all
    you want to do is play a random song every N seconds you can do it
    with just a few lines of code..
    function randomSound()
    stopAllSounds();
    var snd = new Sound();
    var g = random(2) + 1; // 1, 2 or 3
    snd.attachSound("s"+g); // s1, s2 or s3
    snd.start(0, 1);
    randomSound(); // start the first song now
    id = setInterval(randomSound, 10000); // change songs every
    10 seconds
    Make sure you have 'linkage' names for your 3 songs (not
    library names)
    Your original code did play 1 song every 1 second (just makes
    a popping sound when changing that fast) so I suspect that your
    linkage names were missing.
    I wouldn't use a recursive coding like that though. (a
    function that calls itself)
    tralfaz

  • Can sounds be played randomly?

    Hi All,
    Is there a way to play sounds randomly when mail arrives, versus choosing only one sound? I have a bunch of hilarious alerts.
    Thanks,
    Dave

    Not in Mail. Mail only plays one user-selected sound - the new mail sound. Mail only has three other sounds and they are embedded in the Mail application's Resources folder. You can physically replace these four sounds: New Mail, No Mail, Mail Sent, and Mail Fetch Error. They are all .aiff sound files. You can substitute your own four sounds by renaming them to the same names used in Mail, but you cannot have random sounds played.
    Use whatever four sound files you want to be, respectively, New Mail.aiff, No Mail.aiff, Mail Sent.aiff, and Mail Fetch Error.aiff. Quit Mail if it's open. Select the Mail application and right-Click or CTRL-Click to display the contextual menu. Select "Show Package Contents" from the contextual menu. A window will open with q single folder named "Contents." Double-click to open Contents, then locate the folder named "Resources." Copy your custom sound files into the Resources folder. A dialog will appear asking if you want to Replace the existing files. Answer Replace to each. Close the window. Mail will now use your custom sounds in place of the default ones.
    Note that if Mail is updated by any future system upgrade your custom sounds will be replaced by the originals, and you'll have to customize all over again. So don't lose your custom sound files.

  • SOUND KEEPS PLAYING RANDOMLY

    Hello.  I received one of those **bleep** chain texts from a friend who doesn't own a black berry (they use a razor.)  This txt had a joke that you read and a sound that played when you opened it.  I have long since deleted that message.  However, that same sound no plays randomly no madder what.  The sound settings can be silent or vibrate it doesn't matter.  It still plays.  It also plays when I get messages and after hanging up on a phone call.  I pulled the battery and still no luck.  How can I get rid of this thing.   I have never heard of blackberry viruses but hey, there's a first for everything. 

    Hi.  I am sorry the song continues to play even after you deleted it.  I will be happy to help you further.   First, I want you to try dialing *228 option 2.
    Once you do that, please let me know if it continues to make the sound randomly.
    Waiting on your reply
    Thanks!

  • Random sound files play

    Recently, when changing tabs on Firefox, random sound files play. They sounded like PCH sound files so I contacted them. Their support team confirmed that this is a known bug and "would be fixed soon". I can find nothing on the web but few people would associate random Firefox sound files playing with a PCH infection anyway. I want to get rid of them now. Any solutions?
    Windows 8.1, HP Pavilion laptop using Firefox.

    PCH installed the file in FlashPlayer.
    Clearing Flash Cache killed the file and the problem.
    Here are the directions for doing that:
    If you are using a Windows machine running Internet Explorer, Firefox, or Safari:
    Click the "Start" button located in the bottom left hand corner of your screen.
    Windows 8 means a treasure hunt, or Cursor to top right corner, Settings, Control Panel
    Click on "Control Panel" (or depending on your system setup, "Settings" and then "Control Panel").
    Click on "Flash Player" (or "System and Security" and then "Flash Player").
    Click on the "Advanced" tab located along the top of the "Flash Player Settings Manager".
    Ensure the latest version of flash player is installed (click "check now" to verify which version you have installed).
    Click the "Delete All..." button located at the top of the "Advanced" section of the "Flash Player Settings Manager".
    Ensure that there is a checkmark beside the "Delete All Site Data And Settings" option.
    (IMPORTANT: leave the "Delete All Audio and Video License Files" option UNCHECKED).
    Next, click the "Delete Data" button located in the bottom right hand corner of this window.
    Close the "Flash Player Settings Manager".
    Close the "Control Panel".
    Restart your browser
    If you are using Google Chrome please follow the below instructions:
    Click on the following link to navigate to Adobe's online Flash Player Settings Manager.
    Click on the "Delete all sites" button.
    Restart your browser.
    To clear the Flash Player cache on a Mac, please follow these steps:
    Close your web browser.
    Click on the Apple logo in the upper, right-hand corner of your screen and choose "System Preferences"
    Click on the "Flash Player" icon near the bottom of the System Preferences window.
    Under the "Storage" tab, click on the "Delete All" button.
    On the next window, make sure the "Delete All Site Data and Settings" option is selected and unselect the "Delete All Audio and Video License Files" option.
    Click the "Delete Data" button.
    Close the System Preferences window.

  • AE CS5 (10.0.1.19) Ram Preview - Audio stops and continue playing randomly

    I already reported this issue to Adobe as a BUG but I want to ask here if somebody else have this problem or can confirm it.
    Audio breaks/stops and continue playing randomly when 'Ram Previewing'
    It happens mostly when the RAM is fully filled up with image cache files! When the Ram is not filled up totally with image cache files it happens rarely!
    Steps to reproduce BUG / issue:
    1. create a new composition with a length of for example 5 minutes.
    2. create a new solid with size of 50x50 pixel and animate the position of the solid for a very long time so when ram previewing the whole ram/memory gets filled up with different image cache data (this is very important!). Alternatively you could use a long video file to fill up the RAM completely.
    3. import a wave file .wav 16bit 48khz uncompressed which is very long for example 5 minutes.
    4. insert the wave file in the earlier created composition which contain the animated solid or video file.
    5. Set the work area bar (preview range) for the whole composition.
    'Ram Preview' the composition until the whole RAM/memory is filled up with image data.
    AE has to stop rendering because there is no more space available in RAM.
    make sure 'from current time' checkbox is off.
    6. listen to the audio which stops playing randomly for about 1-2 seconds and comes back and continues playing (***BUG***)
    7. Now set the right handle of the composition work area bar (preview range) to less then the maximum RAM size
    (less then the green cache indicator on the right side)
    8. "Purge image caches" or "Purge All"
    9. Ram preview the now smaller work area
    10. listen to the audio. The audio breaks are gone! (***Workaround***)
    Additional information:
    I have the latest After Effects CS5 update installed (10.0.1.19)
    This behavior is tested with different audio drivers inside After Effects CS5 (After Effects WDM Sound, Generic Low Latency ASIO Driver,  ASIO DirectX Full Duplex Driver)
    I also tried different Sample Sizes Buffers (alternatively to the default 2048 samples) but without success.
    Reducing the amount of RAM which After Effects can access didn't solve the problem!
    System:
    Win7 64bit all latest Updates, 8GB RAM, CPU: intel Core 2 Extreme QX9300, nVidia Quadro FX 2700M, IDT High Definition Audio Driver v6.10.0.6227
    There is no driver problem on my system because After Effects CS3 & CS4, Premiere & Soundbooth CS3 CS4 CS5 have no audio problems!
    I have lots of other professional audio software like Steinberg Cubase 5.... on the same system and they all work fine.
    I also turned off AVG Anitivirus and Windows firewall for testing without success.
    AdobeQT32Server.exe, dynamiclinkmanager.exe, PProHeadless.exe, afterfx.exe do not get blocked by firewall they have full permission.
    The CS5 Production Premium installation went fine and without errors and antivirus protection was turned off for the installation.
    Any help would be nice!
    Felix

    Yep, I agree with craulmedia....
    It's 1 month ago after my initial post and no valuable feedback from Adobe although I filled out the bug report in addition to this post and provide my email for further information.
    The only reason for upgrading from CS4 -> CS5 production suite was the use of all my 8GB RAM in AE and now AE can use it but when it's using it the audio have issues.
    CS5 is on the market for nearly a year and still have such essential issues... And my fear rises there will be no valuable update fixing these issues but instead Adobe forces me to upgrade later this year to CS6 in hope something change...
    I have had support request for different Adobe products in the past including telephone support, web support via Adobe ID... none with success the web support answered my request 3 weeks later with the message they will look into it... time went by and in the end the result was "Yes we know it's a known bug" the bug did not get fixed for that CS version. it even exists in the next major CS release! (talking about EncoreDVD here). Once the web support answered weeks later when I was in holidays and after some days I was not able to respond they closed my case. I reopened the case but never got an answer! Telephone support is nearly waste of time because in 95% of all cases it does not help to reinstall the whole operating system and talking to people who know less about computers in general or Adobe products then my mom - it's a waste of time.
    I don't want to blame here anybody for things happend in the past I just want to point out that this time I choose an other support channel (bug report and forum post) but it seems that this support channel is also a waste of time after 1 month with no valueable feedback!
    I bumped up this post 2 times and thanks to craulmedia for the third time.
    And now here is my fourth time *BUMP*
    All I got so far is: "I saw your bug report it's in the queue"
    Is it still in the queue? which queue nr. does it have? how long will it take to get any answer? is it reproducible? Is it confirmed as a known bug by Adobe? Is Adobe working on a fix? When will this fix be available? Is the fix provided in form of an update or in the next major release?
    OK, I know this is a user to user forum and Adobe people only stop by in their free time and there is no guarantee for any real support.
    But it started out so good in the first time...
    Last 2 things I want to add here:
    1. Why should I provide my email in the bug report? Sure so Adobe can get back to me for further information... but wouldn't it be nice if Adobe would be so kind to give some status report to that given email as a small present for the enthusiastic beta testers ?
    2. please Adobe take a look at www.uservoice.com already Autodesk started to move there with 3ds Max.

  • Random sound clips

    got a pavilion d7-6bus laptop problem is  its playing unwanted random audio clips...everything from auto ads to hard rock and cooking tips ....Norton anti virus people say its not a virus...anyone out there have a solution...getting to the point where this computer gonna become part of a landfill

    Hello autodiddy,
    I see that you are having problems with random sound clips on your HP computer. I have some suggestions that may help with this issue.
    I would first suggest doing a clean boot. This will make sure that there are no software programs causing the clips to play. Here is a link that explains how to do a clean boot.
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Lost the ability to play multiple sounds!

    Since switching to archlinux, the only problem that I am unable solve is the inablity to play multiple sounds.. i had this problem when i first installed archlinux. back then i tried installing pulseaudio and found that cumbersome. eventually went back to alsa and found magically i could play sounds at once..
    now again it has reoccurred ever since the module init tools upgrade. i have tried reconfiguring alsa with alsaconf with no avail.
    on trying to play sound file from the 2nd app i get a knotif saying
    The audio playback device HDA Intel (ALC880 Analog) does not work
    Falling back to .
    some of the conf files i have:
    [$]> grep MODULES /etc/rc.conf
    # MODULES: Modules to load at boot-up. Prefix with a ! to blacklist.
    # NOTE: Use of 'MOD_BLACKLIST' is deprecated. Please use ! in the MODULES array.
    MODULES=(e100 mii slhc snd-hda-intel snd-mixer-oss snd-pcm-oss snd-hwdep snd-page-alloc snd-pcm snd-timer snd soundcore !snd-pcsp)
    [$]> grep DAEMONS /etc/rc.conf
    # DAEMONS
    DAEMONS=(syslog-ng dbus @network netfs crond alsa hal cups @openntpd)
    [$]> cat /etc/modprobe.d/modprobe.conf
    # /etc/modprobe.d/modprobe.conf (for v2.6 kernels)
    [$]> cat /etc/modprobe.d/sound.conf
    alias snd-card-0 snd-hda-intel
    alias sound-slot-0 snd-hda-intel
    [$]> cat /etc/libao.conf
    default_driver=alsa10
    [$]> lspci | grep -i audio
    00:1b.0 Audio device: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller (rev 03)

    djszapi wrote:It seems to good. Did you try pulseaudio now too ?
    no i dont want to. it doesn't seem right with kde

  • Urgent: iMovie creating movies with random sounds throughout

    When exporting my iMovie project - which I put together clips from various documentaries, muted them, and put my voice over in mp3 files... random sounds appear at various points - these are the sounds from one video that I've muted.
    The sounds do not even appear during the playing of this video - but others way before it.
    None of this shows up in the preview, and I've tried saving it as both as the highest definition - 1080p, as well as the 'tiny' movie (but even this takes 10 minutes to compile).
    The stange sounds appear at exactly the same place in both versions... I even changed a few things before the second 'tiny' export, but it was still the same.
    The original movie files were high quality, of various formats - mp4, avi, .mov, etc.
    The particular file that the audio is coming from is an mp4 file (1920x1080 originally)- it has been muted in the video, and in the Events browser.
    I downloaded this video from YouTube, via www.keepvid.com - it's called: Coral reefs and climate change- A message for Copenhagen, and can be found here: http://www.youtube.com/watch?v=8SdDiHbG1tY&hd=1
    I have restarted my computer, iMovie, everything...
    ...this video is due ASAP, and I'm not sure how to solve this irritating issue.
    I hope to hear from you!!

    There have been numerous posts about audio issues. In almost all cases, the user has used speeds other than the presets. Changing to the presets fixed the problem. It's possibly a bug in iMovie, or a less than stellar design with the slider - maybe a pop-up box would have been better.
    If you don't want to mess with your project, then duplicate it (File>Duplicate Project). Then make the changes in the duplicate.
    John

  • Select audio device to play back sound

    flash media server ,provide property Microphone.names that
    retrieves an array of strings reflecting the names of all available
    sound capture devices.
    is there is any property that detect output device attached
    to system so i can select which one to play back sound.
    for example:-
    i need to play back mp3 file in flash.
    but i have more one output device installed in my pc.
    the question is:-
    is there is any way for falsh to list all (or detects) audio
    output device installed in my pc then let me pick one of them to
    play back sound by selected output device?
    thanks ...........plz don't late to replay me

    This is a a delayed response to this discussion but I thought I would share my problem with this.
    I have a USB audio interface, which I have configured as the default sound device on my iMac (OSX Lion). This works well in all applications, except Flash.
    I have the device configured at quite a high bit rate.
    Flash doesn't like this - it makes very strange noises. The only work around I have found is to disable the sound interface when I am working in Flash, and use the built in speakers on my iMac.
    It works, but I'm the kind of guy that likes things to just work =)
    e.g. if iTunes can play mp3s through my sound interface, why can't Flash?
    To be honest I think Adobe need to do a lot of work on the audio side of things with Flash. Not just playback - something a bit more flexible like Premier would be cool. Flash isn't dead yet. Come on Adobe!
    A lot of the work I am doing at the moment requires building animation to a pre-recorded audio file.

  • Messages keep playing woosh sounds

    Hi,
    I have just startet using facebook chat with the jabber feature in "messages".
    It seems to me that messages keep playing random "woosh" sounds now and  then, the sound it makes when you remove a shortcut from the desktop.
    I cannot seem to find the option where to control this output sound and its making me crazy.
    I hope some one can help me
    // qbell

    I think I have a solution.
    Go to notifications Pref Pane and
    make sure Messages has "Play sound
    for notifications" is checked:
    https://dl.dropboxusercontent.com/u/1869826/FileChute/cdfdf.mp4
    <img src="https://dl.dropboxusercontent.com/u/1869826/FileChute/Untitled.jpg"/>
    Thanks  ...  Ken

  • Problem playing MIDI sounds

    I was wondering if anyone knows what I'm doing wrong. The code below plays a sound when the instrument is in bank 0 (for instruments in the array with index < 128) but not for bank 1 (with index >= 128). I can loop through and print out all the instruments, but can't play them all.
    Thanks for any help!
    MidiChannel[]     midiChannels = synth.getChannels();
    int nNoteNumber = 64; // 60 is Middle C
    int instNum = 165;
    int nVelocity = 100; // volume
    //Works fine - prints 188 instruments
    for (int j = 0; j < inst.length; j++)
         System.err.println("Instrument " + j + inst[j]);
    synth.loadInstrument(inst[instNum]);
    midiChannels[0].programChange(inst[instNum].getPatch().getBank(), inst[instNum].getPatch().getProgram());
    // Only works when instNum < 128
    midiChannels[0].noteOn(nNoteNumber, nVelocity);

    Hi
    I was having a similar problem. This method: MidiChannel.programChange(int bank).
    Well, you would think that passing in the bank here would work, wouldn't you? I notice that that's what you have done.
    But for some reason, in the sample code that comes with the API, I notice that they seem to pass in the instrument index in the array returned by getAvailableInstruments. I tried this and it worked.
    hth

  • Loading and Playing Multiple Sounds

    I have written a loadSound function which handles loading and playing multiple sounds. This function works fine when I call this function in another keyframe i.e. the frame in which the function is not written. But when I call the function on the same frame in which the function is written the sounds gets mixed up. For example the function is written in 1st keyframe. If I call this function in 2nd, 3rd and 4th keyframe (with different sounds) it works fine. But when i call the same function in 1st, 2nd and 3rd keyframe it all gets messed up.
    In 1st keyframe the sound plays properly. When I move to 2nd Keyframe the 2nd sound plays. But when I move back to the 1st keyframe the 2nd and 1st keyframe sounds all get mixed up. This doesn't happen when I call the function in 2nd, 3rd and 4th keyframes.
    Below is my function:
    import flash.events.Event;
    import flash.media.Sound;
    import flash.net.URLRequest;
    import flash.events.ProgressEvent;
    import flash.events.IOErrorEvent;
    import flash.errors.IOError;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.display.MovieClip;
    import flash.media.SoundTransform;
    stop();
    var s:Sound;
    var localSound:SoundChannel = new SoundChannel();
    var req:URLRequest;
    var loadedPct:uint;
    var currentFrameArr:Array = ["One","Two","Three"];
    var urlArr:Array = ["sound/m01_t01_s01.mp3","sound/m01_t01_s02.mp3","sound/page10_11.mp3"];
    function loadSnd(currentFrm:String)
    s = new Sound();
    s.addEventListener(ProgressEvent.PROGRESS, onSoundProgress);
    s.addEventListener(Event.COMPLETE, onSoundLoaded);
    s.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
    localSound.stop();
    for (var i:uint=0; i<currentFrameArr.length; i++)
      if (currentFrm == currentFrameArr[i])
       req = new URLRequest(urlArr[i]);
    s.load(req);
    function onSoundProgress(evt:ProgressEvent):void
      loadedPct = Math.round(100 * (evt.bytesLoaded / evt.bytesTotal));
      trace("The sound is " + loadedPct + " % loaded");
    function onSoundLoaded(evt:Event):void
      localSound = s.play();
    function onIOError(evt:IOErrorEvent):void
      trace("The sound could not be loaded: " + evt.text);
    Call to this function in different frames:
    loadSnd("One");
    loadSnd("Two");
    etc
    If I pass the parameter 'One' in loadSnd it plays the 1st element in urlArray, 'Two' 2nd element and so on.
    I have been scratching my head since long over this.
    Can anybody please pinpoint the error.

    Got the solution. The SoundMixer.stopAll(); statement did the trick. The complete workable function is pasted below:
    import flash.events.Event;
    import flash.media.Sound;
    import flash.net.URLRequest;
    import flash.events.ProgressEvent;
    import flash.events.IOErrorEvent;
    import flash.errors.IOError;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.display.MovieClip;
    import flash.media.SoundTransform;
    stop();
    var s:Sound;
    var localSound:SoundChannel = new SoundChannel();
    var req:URLRequest;
    var loadedPct:uint;
    var currentFrameArr:Array = ["One","Two","Three"];
    var urlArr:Array = ["sound/m01_t01_s01.mp3","sound/m01_t01_s02.mp3","sound/page10_11.mp3"];
    function loadSnd(currentFrm:String)
      s = new Sound();
      s.addEventListener(ProgressEvent.PROGRESS, onSoundProgress);
      s.addEventListener(Event.COMPLETE, onSoundLoaded);
      s.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
      SoundMixer.stopAll();
      localSound.stop();
      for (var i:uint=0; i<currentFrameArr.length; i++)
      if (currentFrm == currentFrameArr[i])
      req = new URLRequest(urlArr[i]);
      break;
      s.load(req);
    function onSoundProgress(evt:ProgressEvent):void
      loadedPct = Math.round(100 * (evt.bytesLoaded / evt.bytesTotal));
      trace("The sound is " + loadedPct + " % loaded");
    function onSoundLoaded(evt:Event):void
      localSound = s.play();
    function onIOError(evt:IOErrorEvent):void
      trace("The sound could not be loaded: " + evt.text);
    Calling the function
    loadSnd("One");
    loadSnd("Two"); etc

Maybe you are looking for

  • Text entry boxes in CP6 - Enter key to validate input does not work in Safari?

    I'm using Captivate 6 to create a step by step walkthrough of some different processes that are commonly completed in my workplace. Some of the example processes have portions where text is entered to simulate a process the end user might need.  I ha

  • Unread Mail badges won't go away

    Mail v7 (1822). Anyone else have this issue? I have many folders set up within Mail. I have an IMAP account, but have Rules to transfer messages to folder On My Mac. What's started to happen is the badges that usually appear associated with the folde

  • Smpatch analyze fails to run on Solaris 10 Sparc systems

    I have two Sparc Solaris 10 systems that I am unable to get to successfully patch. The 'sconadm' tool runs correctly, but smpatch bombs out with one of the following two errors: Failure: Cannot connect to retrieve current2.zip: You are not authorized

  • Fingerprint scanner on Win 7 64-bit slows machine

    Brand New Tecra R840. Running Windows 7 Enterprise 64 bit. Any ideas on how to make the fingerprint utility more responsive. There is a 3-10 second lag when trying to log in , or unlock the computer. It scans just fine, but the time between the compu

  • Upgraded Mid 2012 MacBook Pro RAM - Issues

    Hi, I recently upgraded the RAM on my Mid 2012 15" MacBook Pro from 4GB which it came with to 16GB. Now I checked online that 16GB was the maximum reported, stable RAM that MacBooks could run so stuck to that. For no reason other than greed, silly nu