Random array sound selection problem

Hello,
I'm a gigantic AS3 noob so please be gentle with me. I have probably simply done something very stupid.
I have an animated character and a set of footstep sounds, and have set up code so that at a set point in the walk cycle a random footstep sound is played based on frame label selection. The following code is in the character movieclip:
function getRandomLabel():String {
  var labels:Array = new Array("step1", "step2", "step3", "step4","step5", "step6", "step7", "step8");
  var index:Number = Math.floor(Math.random() * labels.length);
  trace (labels[index])
  return labels[index];
step1, 2 etc refer to the frame labels of the sound movieclip I have nested inside the character movieclip, which contains the eight sounds on 8 frames with appropriate labels (plus an additional blank frame at the beginning).
At the frames in the character animation where I wish a footstep sound to play, I have the code:
this.soundtest.gotoAndStop(getRandomLabel());
'soundtest' is the name of the sound movieclip containing the footsteps. This works perfectly; I get a random sound at the right time on each footfall. The weird problem is that if the random label index returned is the same as the previous one (i.e. step1 and step1 again) the second sound does not play. This only happens if the same label is repeated, otherwise it works fine. So the footsteps have occasional breaks in them where 'something' prevents repeat sounds/array indices being played. What could be the problem here?
Thanks in advance.

If you are going to and stopping at the same frame you are already in you are not going and stopping anywhere, so the sound does not re-execute as if you just entered the frame.
You should look into loading the sound dynamically if you want an approach to have the same sounds repeatable.  That way you don't need to move around a timeline.
If that's too much for you to want to try to tackle (it is not difficult) then an alternative could be to avoid repeating the same sound by putting in some conditional logic in your function that checks if the currently selected sound is a repeat of the one just played, and if so, pick another... until a non-repeat is selected.

Similar Messages

  • Select Problem For 'Back Menus' - Zen V P

    Just got the Zen V Plus and tried to set the time/date. Followed the 'guide' and after the time/date screen pressed the 'back button'. Got the Set Alarm/Date/Time (etc) menu but when I selected an option (moved joystick down to desired option then pressed the joystick) the time/date display came up and I was NOT ABLE to set the date. Same thing occurred trying to set the date (tried it several times and it worked once .... then attempted again - several times (4) but it only worked once). Turns out I have the same problem with any option in ANY 'back' menu. Suggestion?
    Do I have a defecti've unit (can't be the 'operator' who is defecti've! haha)? Should I return it and try another?
    Actually not that interested in playing music .... it's more for playing .wma(DRM) book files.

    Latest ... updated my firmware (to ZENVPlus_PCFW_P4S_L2___0.exe) and it fixed the select problem for SET DATE/TIME etc however
    the SELECT procedure doesn't always work for 'back button' menus. Example: tried to set a bookmark... following procedure in 'guide', pressed 'back button' and held it, from 'NOW PLAYING' screen - works 2 out of 5 times. Most of the time, pressing and holding takes you back to the previous menu - not to the 'back' (or in this case the SET BOOKMARK) menu. Sounds like something for the next version of firmware ... the code doesn't always set an internal timer correctly (am a programmer of 30 years ... part of that time pgmmng firmware).

  • HT4085 Some videos that are taken with my iphone's camera are not making sounds, this problem occured today to all videos i record, please help

    Some videos that are taken with my iphone's camera are not making sounds, this problem occured today to all videos i recorded starting from today, please help

    It also takes time for the photos to be transferred out of your iPhone and into Photo stream on Apple's iCloud servers.
    Note that this can't happen if your iPhone is not connected to a WiFi network:
    When you enable My Photo Stream on your devices, all new photos you take or import to those devices will be automatically added to your photo stream.
    iOS devices: New photos you take are automatically uploaded to your photo stream when you leave the Camera app and are connected to Wi-Fi. My Photo Stream does not push photos over cellular connections.
    Macs: Any new photos you import to iPhoto or Aperture begin uploading automatically when you have a Wi-Fi or Ethernet connection. Or you can change your iPhoto or Aperture preferences so that only photos you manually add to My Photo Stream are uploaded.
    PC with iCloud Control Panel 2.0 or later: Open a Windows Explorer window and under Favorites select iCloud Photos if you are using iCloud Control Panel 3.0 (or Photo Stream if you are using 2.0 to 2.1.2). Open My Photo Stream. Click the "Add photos" button. Select the photos to import to My Photo Stream, then click Open.
    from here: http://support.apple.com/kb/ht4106

  • Does your Macbook make Random Popping Sounds?

    Hi all, does your Macbook make random popping sounds, on startup and periodically when your using your MB. I have this issue with two macbooks and i can't seem to find many other people who have this problem. I'm unsure whether it's the audio popping issue mentioned in other threads because this happens when no external speakers are plugged in. It's just pops away on it's own and it's driving me mad, i can't even pin it down to a specific task because it;s so random.
    Both of my Macbook are operating under 10.4.11.
    Arrrrrrrrggggggggggghhhhhhhhhhhhh

    Actually now that you've mentioned it, mine sometimes randomly makes the popping sounds, more to the likes of 'clipping' of speakers. But the odd thing is, mine only pops when connect my speakers (it's a Cambridge Soundworks 4.1 setup which i purchased over 6 years ago) - and the speakers have been fine all these while? I am positive that it's not my speakers because just recently (2-3 days ago) my brother brought his HP laptop and used my speakers and i did not hear anything even after he left his inferior (haha kidding) laptop on my desk to have a smoke without any music/sound coming out of the speakers.
    To be more precise. my popping sound occurs specifically (as I haven't tried others) as I pause my music on iTunes. It does annoy the h*ll out of me and I really assumed that it was my speakers.
    At least I'm not alone now. My Macbook specs are listed below.

  • Random audio sounds

    I just got my notebook 4 days ago. The first 2 days were fine, but the last 2 days I've been getting seemingly random "funk" sound alerts. Sometimes I'm typing, other times I'm not even touching the computer when these sounds occur. No info box comes up to explain an error message or anything.
    Also, today I navigated to my mail.com email account & I kept hearing a recorded voice say "heeelllooo" while I was on that website, and also occasional noises that sounded like a camera shutter.
    I've contacted Apple about the first problem, but they had no answers for me.
    Does anyone have any insight into these strange & random alerts??? This is my first Mac, so I'm not terribly familiar with the system & I REALLY don't want to go back to PC.
    Any help or suggestions will be greatly appreciated!!

    I just got my notebook 4 days ago. The first 2 days
    were fine, but the last 2 days I've been getting
    seemingly random "funk" sound alerts. Sometimes I'm
    typing, other times I'm not even touching the
    computer when these sounds occur. No info box comes
    up to explain an error message or anything.
    Also, today I navigated to my mail.com email account
    & I kept hearing a recorded voice say "heeelllooo"
    while I was on that website, and also occasional
    noises that sounded like a camera shutter.
    I've contacted Apple about the first problem, but
    they had no answers for me.
    Does anyone have any insight into these strange &
    random alerts??? This is my first Mac, so I'm not
    terribly familiar with the system & I REALLY don't
    want to go back to PC.
    Any help or suggestions will be greatly appreciated!!
    I have noticed on many occasions that certain websites are able to somehow perform funny noises and alerts when you mouse over a button in your web browser. This happens occasionally to me but I am pretty sure it has something to do with the website that you are at. I have noticed that same thing happening (occasionally) when I visit www.wunderground.com. Since it only happens occasionally, it may in fact be coming from one of the banner ads instead of the main website itself. I would experiment and see if it happens when your browser is not at mail.com.
    Powerbook G4   Mac OS X (10.4.5)  

  • Random "clicking" sound when 16GB iPod touch docked with speakers

    Hi all,
    My friend recently got a 16GB iPod touch. It works fine with headphones but whenever she docks it into her speakers or my own a random clicking sound can be heard. It doesn't matter if the thing is actually playing a track or not, so long as it's docked on the speakers the sound is heard. It also happens with the wi-fi switched off.
    She recently paid the £12.99 for the update that adds Google maps etc. so I was thinking maybe that would update the firmware and fix the problem but it hasn't. I'm suspecting a fault with her iPod, has anyone else encountered this issue and knows of a fix short of returning it to Apple for a working one?
    Thanks in advance,
    8

    Thanks very much, that seems to have fixed it!
    Must admit I was a little skeptical but on my speakers (Altec Lansing ones) it's silent when not playing music and no distortions or clicks are audible when it is. On my friend's own speakers (some fairly anonymous brand) there is a little hissing and clicking but I think they do that with my own 1st generation Nano plugged in. She's getting some new Logitech ones, a set for her living room and another for her bedroom so hopefully that's it sorted.
    Cheers again!
    8bit

  • My ipod touch 4g screen cracked and is making random touch screen selections?

    i have a jailbroken ipod touch 4g and I dropped it on the ground yeesterday, now it is making random touch screen selections; the upper part of the screen will not recognize any touches at all. please help

    ipt140 wrote:
    look, just because you like apple and they hate jailbreakers doesnt mean that the answer to every problem is "go buy a new one, go buy a new one" some people come on this site for help.
    I really don't care what anyone does with their Apple stuff. It's theirs to do with as they please, including jailbreaking or smashing them with a brick. It makes no difference to me, or their iPods for that matter.
    In either case the answer is the same: "Go buy a new one".

  • Selection Problem with JTable

    Hello,
    i have a selection problem with JTable. I want to allow only single cell selection and additionally limit the selection to the first column.
    I preffered the style from MS Outlook Express where you can select the email accounts to edit.
    It is a table like this:
    Account name  |   Type  |   ...
    --------------|---------|---------------------
    Hotmail       |   POP3  |
    GMX           |   IMAP  |The selection should be only avaibable at 'Hotmail' or 'GMX' - not at 'POP3', 'IMAP' or as complete row selection.
    Please help me!
    Thanks.
    Warlock

    Maybe this will helpimport java.awt.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        String[] head = {"One", "Two"};
        String[][] data = {{"R1-C1", "R1-C2"}, {"R2-C1", "R2-C2"}};
        JTable jt = new JTable(data, head);
        jt.getColumnModel().setSelectionModel(new MyTableSelectionModel());
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        jt.setCellSelectionEnabled(true);
        jt.setRowSelectionAllowed(false);
        jt.setColumnSelectionAllowed(false);
        setSize(300, 300);
        setVisible(true);
      public static void main(String[] arghs) { new Test3(); }
    class MyTableSelectionModel extends DefaultListSelectionModel {
      public void setSelectionInterval(int index0, int index1) {
        super.setSelectionInterval(0, 0);
    }

  • Print selection problem

    when i select a page to be print from my pc the page select in

    Hello. I feel your pain and frustration with the print selection problem in safari, especially in Snow Leopard. I have spent hours trawling help pages and forums etc. BUT YEE HAA (sorry got a bit excited, but it really was hours) I found the answer. So here goes.
    Click on Safari
    Scroll down to services then slide to right
    Scroll down to services preferences and click
    Scroll down to the Text section
    If you Tick the Text box it will choose all options for you. Or if you don't want all options in the Text list, then untick Text box and tick options you do want.
    BUT for your print selection problem make sure you tick NEW TEXT EDIT WINDOW CONTAINING SELECTION.
    Then when you want to select something in a web page you want to print (including pictures etc) then highlight it, then Right click. And low and behold, in the list is NEW TEXT EDIT WINDOW CONTAINING SELECTION. Click that, Then press cmd+p and your printing.
    I really hope that helps with your problem
    I can now go to sleep.

  • At Line selection problem

    hi,
    iam stuck up with AT LINE-SELECTION problem ie i designed a screen where they need month list on clicking F4. i got the month list using month_names_get in the screen but while clicking the relevant month no.it's not entering into the required parameter. i have attached the codings,
    MODULE MONTH_DIS OUTPUT.
      SUPPRESS DIALOG.
      LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
      SET PF-STATUS SPACE.
      NEW-PAGE NO-TITLE.
      WRITE:/ 'SELECT MONTH' COLOR COL_HEADING.
      ULINE.
      DATA: T_MNTH LIKE T247 OCCURS 12 WITH HEADER LINE.
      refresh t_mnth.
      CALL FUNCTION 'MONTH_NAMES_GET'
       EXPORTING
         LANGUAGE                    = SY-LANGU
    IMPORTING
      RETURN_CODE                 =
        TABLES
          MONTH_NAMES                 = T_MNTH
       EXCEPTIONS
         MONTH_NAMES_NOT_FOUND       = 1
         OTHERS                      = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      loop at t_mnth.
        write:/ t_mnth-mnr, t_mnth-ltx.
      endloop.
      CLEAR T_MNTH-MNR.
    ENDMODULE.                 " MONTH_DIS  OUTPUT
    AT LINE-SELECTION.
      p_period = t_mnth-mnr.
      CHECK NOT p_period IS INITIAL.
      LEAVE TO SCREEN 0.
    here in the AT LINE-SELECTION, the selected month is not coming to the required parameter.
    pls help me in this issue,
    Thanks in advance,
    Premnath.

    You need to set a "Hide" after the write... I suggest you also set your own dialog PF-STATUS too so you can have just a PF2 "pick" button and a Cancel button ( this will look better to the user).
    loop at t_mnth.
      write:/ t_mnth-mnr, t_mnth-ltx.
      hide: t_mnth.  "needs this
    endloop.
    clear: t_mnth.

  • Weird BGP path selection problem

    Hi, all,
    I am seeing a weird BGP path selection problem on 4948 switch running cat4500-entservicesk9-mz.122-46.SG.bin code, this switch has two uplinks to the same ISP's different edge router, one circuit is primary the other one is strict backup, only default route is accepted from ISP. I am setting both local preference and weight to the default route advertised over backup link, however neither one is taking effect, BGP still thinks the backup link is better, what could be wrong?
    rtr#sh ip bgp 0.0.0.0/0
    BGP routing table entry for 0.0.0.0/0, version 105
    Paths: (3 available, best #2, table Default-IP-Routing-Table, not advertised to EBGP peer)
      Not advertised to any peer
      17675, (received & used)
        203.169.8.37 from 203.169.8.37 (61.211.160.150)
          Origin IGP, localpref 100, valid, external
          Community: 65001:0 no-export
      17675
        203.169.8.45 from 203.169.8.45 (61.211.160.151)
          Origin IGP, localpref 90, weight 90, valid, external, best <====
          Community: 65001:0 no-export
      17675, (received-only)
        203.169.8.45 from 203.169.8.45 (61.211.160.151)
          Origin IGP, localpref 100, valid, external
          Community: 65001:0 no-export
    Thanks

    Hi,
    On cisco routers , weight is having highest preference to decide best path. By default for received route, weight is 0 but you are setting weight 90 to backup path and that is why it is getting preferred (higher is better). Please remove weight and let local preference be 90 (lesser than route on primary path)
    --Pls dont forget to rate helpful posts--
    Regards,
    Akash

  • Sound device problem in ZONE

    I created a solaris zone for my desktop use, but the sound device was not avaialbe. I tried to export it from the global zone:
    device
    match: /dev/sound/*
    then rebooted the zone, login it, found there were several files added in /dev:
    lrwxrwxrwx   1 root     root           7 Sep 17 14:50 /dev/audio -> sound/0
    lrwxrwxrwx   1 root     root          10 Sep 17 14:50 /dev/audioctl -> sound/0ctl
    crw-------   1 root     root      34,  0 Sep 17 14:50 /dev/sound/0
    crw-------   1 root     root      34,  1 Sep 17 14:50 /dev/sound/0ctlThe problem is: how to change the /dev/sound/* files for all users to read and write, permanently?
    I tried the following methods but failed:
    1. Change manually these files' mode to a+rw as root. But once I logged out the zone or rebooted the zone, the changes were lost.
    2. Create a script in /etc/init.d/ and link it to /etc/rc3.d/ to let it auto execcute when boot, as below:
    #!/sbin/sh
    /usr/bin/chmod a+rw /dev/sound/*
    echo `date '+%D %H:%M:%S' > /var/tmp/enable.audio.log
    ls -le /dev/sound/* >> /var/tmp/enable.audio.logthe content of /var/tmp/enable.audio.log is something like:
    crw-rw-rw-   1 root     root      34,  0  9&#26376; 17 14:50:30 2005 /dev/sound/0
    crw-rw-rw-   1 root     root      34,  1  9&#26376; 17 14:50:30 2005 /dev/sound/0ctlBut oddly, the permissions of these files would always be changed back to the original state soon, automatically.
    3. I added an entry in /var/spool/cron/crontabs/root to change the permissions every 10 mins, and it did work, strangely. However I think it's not a good method, because I have to wait for 10 minutes before I can login it (if I login the zone before the permissions were changed, the sound device will never work)
    Thanks in advance.

    It's probably /etc/logindevperm that's fighting you. Read the comments in that file, then you can modify /dev/sound in it.
    The idea is that only the user logged in on the console would normally have access to the audio device and the frame buffer, so the permissions are reset at login.
    If you're having folks login through a separate zone, this changes that assumption.
    Darren

  • Certificate selection problem in Safari

    Hi ,
    I have certifcates A,B,C,D for the same site , whenever i use the Mozilla it is asking which one to select , but somehow i dont know why Safari is asking the same option.
    It is forcing me to accept Certifcate A to that paricular site. How to solve this problem in safari.
    Regards
    Vikranth

    Hello. I feel your pain and frustration with the print selection problem in safari, especially in Snow Leopard. I have spent hours trawling help pages and forums etc. BUT YEE HAA (sorry got a bit excited, but it really was hours) I found the answer. So here goes.
    Click on Safari
    Scroll down to services then slide to right
    Scroll down to services preferences and click
    Scroll down to the Text section
    If you Tick the Text box it will choose all options for you. Or if you don't want all options in the Text list, then untick Text box and tick options you do want.
    BUT for your print selection problem make sure you tick NEW TEXT EDIT WINDOW CONTAINING SELECTION.
    Then when you want to select something in a web page you want to print (including pictures etc) then highlight it, then Right click. And low and behold, in the list is NEW TEXT EDIT WINDOW CONTAINING SELECTION. Click that, Then press cmd+p and your printing.
    I really hope that helps with your problem
    I can now go to sleep.

  • I am trying to create N random arrays of a given length help please!

    Hi,
    I was given this picture last week as a block diagram in order to create N arrays of a specified length M. The array is to have a floating point representation (i.e. the values that make up the array of numbers can be anything specified by myself.
    I attach the picture here and was wondering if someone could tell me what the block diagram object to the right of the random number block diagram object is and where I can find it in LabVIEW, also the block diagram object underneath "N random arrays".
    Thanks, This picture is from LabVIEW v.6.1, I am using LabVIEW v.7.1.
    Alan Homer
    Message Edited by alanhomer on 03-21-2006 03:28 AM
    Attachments:
    N random arrays.png ‏5 KB

    Hi Alan,
    The function you want is a bundle found on the cluster palette. You need to make the bundle smaller as it comes off the palette with 2 input.
    I attach a VI that is a match to the image you sent, this contians everything wired together and should work out of the box.
    Regards
    JamesC
    NIUK and Ireland
    Attachments:
    alanhomer.vi ‏20 KB

  • I  have a random cricket sound on my Mac 24

    I have a random cricket sound on my Mac 24...only on sound system, music still plays, no other apparent malfunction.  Tried Apple store geniuses and none had heard of it.

    Relax, it was nothing you did. These are music libraries that other users on your network have decided to share over the network. These libraries are not on your computer and if you decide to, you can play the music from their computer.
    But if you do not want to see these shared libraries, then go to the iTunes menu, Preferences and the Sharing tab. Uncheck the box that says "Look for shared libraries."

Maybe you are looking for

  • Only RG23 A/C Part-2 Posting for free goods

    Hi Gurus, Hi Every one, how are you, i have one requirement from client. 1. this case is for free goods, where client wanted to take   credit for material purchase ie only part-2 entry should get posted, 2. Liabilities should not get posted. As  per

  • Client Security Password manager not working

    Hi All, Have a T500 (model 2081CTO) running Win 7 Prof, with fingerprint reader.  Had installed and had working Enhanced Client Security, was web aspect of capturing / prompting userids and passwords just fine. Needed to reset IE8 to default.  That s

  • Using SAP Webservice in Netweaver Dev. Studio

    How can use SAP Webservice in Netweaver Dev. Studio and using EJB? Is there any blog, forum you know? I have lost on forum for searching because so many things related on web services.. Thanks in Advance Best Regards Eray

  • What are Wireframes in portal? is it a sap tool?

    Hi  Guru's, What are Wireframes in portal? is it a sap tool?   According to my search in web it seems to be a tool where we will be developing prototype for our web project. Does sap has any new tool which is similar to Wireframes. Regards, Kiran Kum

  • How does one turn off institution name, use graphic instead

    Instead of using Apple provided institution name, I'd like to turn that off and use the one embedded in the graphic I've already uploaded instead. How do you do that?