Change sounds, by clicking same button

I need to create a button, that will play one sound at a time
when it's being clicked, switching to a different sound from the
library each time it's clicked. (I have about 10 sounds at the
library I need to rotate when the user keeps clicking the button.)
I'm new to actionscript, so I apologize for not, having any
code to start with! I've looked everywhere online and can't find a
tutorial for this. Any help would be appreciated! Thanks!

Actually, I got it to work - I just removed the line
s.stop( );
and I changed
s.indexVar=0;
to
s.indexVar=1;
so here's the code as it is now:
s=new Sound(this)
s.indexVar=1;
soundbtn.onPress=function(){
s.attachSound("sound"+s.indexVar++);
if(s.indexVar>9){
s.indexVar=1;
s.start();
}

Similar Messages

  • Playing a sound by clicking a button

    hello,
    I'm a beginner in programming java.
    now I have the problem that I don't know how two make a button playing a beeping sound if you click on it.
    Is there anybody woh can help me???
    thanks a lot...

    if(event.getSource()==myButton) {
    java.awt.Toolkit.getDefaultToolkit().beep();Hey Wat other noises can i make?
    please email them to me at [email protected]
    Thanks alot

  • Screen get changed while clicking on button in enhancement CEWB_TSK_SCREENS

    Hello Everybody
    I am implementing one BAdI CEWB_TSK_SCREENS for customizing in CEWB transactions and I have developed one screen for that.
    I have one table control on the same screen and I am providing some buttons like 'DELETE' 'CREATE' or 'DISPLAY' to perform some activity on table control.
    But whenever I clicked on button the screen get changed and it sets to some other screen.
    Can anybody help me out on the same?
    regards,
    Bhavin

    hai,
      i am also new to this,i am trying on that only ,it is not allowing me change the screen is there is a need for access key for that, reply me .iam waiting for ur reply.
    shan

  • TS4080 apple thunderbolt display image on display intermittently goes dark, does not wake from sleep after clicking mouse or keyboard, but there is "bonk" sound after clicking mouse or pressing keys. Rebooting by pressing the power button resolves issue.

    My apple thunderbolt display (which I purchased 1.5 years ago; OS 10.7.5 Mac Mini) intermittently goes dark, does not wake from sleep after clicking mouse or keyboard, but there is "bonk" sound after clicking mouse or pressing keys, so am thinking it is a hardware problem with the display. Rebooting by pressing the power button turns the screen back on, but the same phenomenon has occurred several times. Could this be a software issue, or do I need to have my display repaired? Your feedback would be appreciated.

    Hi ED, tough to tell, but it does sound like it's waking with the bonk, just not displaying.
    Long shot but...
    I wonder if it's a variation of this, of which I've seen many different symptoms...
    Resolution
    Move the mouse or trackpad cursor over the center area of the login window so you can see the user icons. Click on the icon of the user that you would like to login as, type in the user's password, and press Return.
    If the login window is configured to show only the name and password fields, type in the user's name and password into the fields, and press Return (even if you cannot see the rest of the login window).
    Additional Information
    This issue will not occur if the display is not sleeping when the account is logged out. Use the steps below to confirm that the account is not configured to log out automatically while the display is sleeping:
        1.    Open System Preferences > Security & Privacy > General.  Click the padlock to unlock the preference pane and enter your admin password. Click the Advanced button at the bottom, then see if the option "Log out after N minutes of inactivity" (where N is the number of minutes) is enabled.
        2.    Open System Preferences > Energy Saver and configure Display Sleep to occur after the account is logged out, by dragging the slider to a number of minutes that is greater than N was set to in the previous step.
    Important: If automatic log out is not needed, disable "Log out after Nminutes of inactivity" in System Preferences > Security & Privacy > General. This will also prevent the issue.
    http://support.apple.com/kb/TS4135?viewlocale=en_US

  • Event handling while changing the value or clicking the button

    Hi All,
    I am working on Jdeveloper 11.1.1.5.
    I have a must requirement where i have a textbox and a button.
    Now if a user changes the value of the textbox then i need to show a dialog to the user for the confirmation that whether he wants to continue or not.
    And on click of button i execute my business logic and commit in the database.
    NOTE :- I am opening that dialog on the valueChangeEvent of the textbox.
    Case 1 :-
    User enter a value in the textbox and tab out the field , value change occurs and dialog displayed onto the page. -> CORRECT
    Case 2 :-
    User enter a value in the textbox and does not tab out the field and directly click on the button.In that case , actually valueChange and button code both executes at the same time.I mean to say , the user click on the button , i get the dialog , but my business logic also gets executed. -> INCORRECT(ISSUE)
    How should i restrict the button logic to be executed till the dialog has been shown and user has confirmed.
    Kindly suggest!!!
    Regards,
    Shah

    Hi Shah,
    You can try something like this:
    <af:inputText autoSubmit="true" id="it1" ...>
      <af:setPropertyListener from="true" to="#{viewScope.uncommittedData}" type="valueChange"/>
    </af:inputText>
    <af:commandButton partialTriggers="it1" disabled="#{viewScope.uncommittedData ne 'true'}" .../>AP

  • How do I turn off Headphones?  My phone rings but all other alerts have been changed to headphones, so no sound. (tried sounds, settings, manual side buttons)

    How do I turn off Headphones?  My phone rings but all other alerts have been changed to headphones, so no sound. (tried sounds, settings, manual side buttons)

    As was already said: the camera's interpretation of the raw data is just one interpretation, and not the same as Adobe's. Don't confuse it with "exactly how they were shot", as this doesn't apply when shooting Raw. Granted it IS the manufacturer's interpretation, but you wouldn't be shooting Raw and using Adobe Camera Raw if you thought the manufacturer was always right.
    One thing nobody has mentioned is Adobe's "baseline exposure" compensation factor. Camera Raw adjusts the default preview exposure by a factor of EV based on their measurements of the camera sensor. My present camera is boosted by 0.35EV and my last camera by 0.5EV. There is a way of determining this using EXIFTOOL, but I can't remember how to do it offhand. For the last few years, I have adjusted my own Camera Raw defaults by reversing this compensation, so it more closely matches the exposure I was expecting.
    EDIT: here's the procedure, if you're interested. Re: Baseline Exposure

  • HT201209 Trying to redeem a free download for a song from KLove. When I get into my acct & try to redeem it, it just keeps bringing up the "sign-in" box. When I click the button on KLove's webpage to redeem it takes me to that page but does the same thing

    Trying to redeem a free download for a song from KLove. When I get into my acct & try to redeem it, it just keeps bringing up the "sign-in" box. When I click the button on KLove's webpage to redeem it takes me to that page but does the same thing

    Get the redeem code from the KLove page:
    http://www.klove.com/music/store.aspx
    ...and enter it into the Redeem Code box in the iTunes Store.
    You will have to sign in to your iTunes account.
    It worked fine here.  If that doesn't work for you, let us know what went wrong.

  • How to use Java Robot to click the same button multiple times

    Hi All,
    I am trying to use Java Robot to turn a Windows utility located on the Desktop by clicking the same button on and then off with the following code:
      1.  Robot robot1 = new Robot();
      2.  robot1.mouseMove(400,180);
        // Turn on the utility
      3.  robot1.delay(100);
      4.  robot1.mousePress(InputEvent.BUTTON1_MASK);
      5.  robot1.delay(100);
      6.  robot1.mouseRelease(InputEvent.BUTTON1_MASK);
        //Wait for 2 minutes
      7.  robot1.delay(200);
        // Move the mouse to disconnect button
      8.  robot1.mouseMove(400,180);
        // Turn off the utility
      9.  robot1.mousePress(InputEvent.BUTTON1_MASK);
    10. robot.delay(100);
    11. robot.mouseRelease(InputEvent.BUTTON1_MASK);However, only the first click (line 1 - 7) worked. Everything from step 8 onwards doesn't appear to be doing anything. Even instantiating another robot2 to carry out step 8 - 11 did not work either. Also have tried running steps 9 - 11 only. ie skip 8.
    My aim is to turn this tool on and off at regular interval.
    Any assistance would be greatly appreciated.
    Thanks in advance,
    Jack

    Hi darth_code_r and Vincent,
    Both you and Vincent are right about insufficient time between the release ( 6 ) of mouse button and step ( 9 ) press the same button again to turn it off. You are also correct in saying that it was not necessary to move the mouse again ( 8 ) since it was sitting on the right button already.
    Below is the code I have ended up with which worked for me:
    1.  Robot robot1 = new Robot();
    2.  robot1.mouseMove(390,150);
    4.  robot1.mousePress(InputEvent.BUTTON1_MASK);
    6.  robot1.mouseRelease(InputEvent.BUTTON1_MASK);
         //Wait for 3 minutes
    7.  robot1.delay(30000);
    9.  robot1.mousePress(InputEvent.BUTTON1_MASK);
    11. robot1.mouseRelease(InputEvent.BUTTON1_MASK);This utility also takes a few seconds to turn itself on and vice versa. As a result, it is necessary to give it sufficient time to turn on prior to turning it off again with the second mouse press.
    Thanks to both of you very much,
    Jack

  • The App Store said I needed to switch countries so I clicked the button and it switched it for me but now I can't update my apps but when I try to change it through settings it still says the country is the u.s. I don't know what to do to change it back

    The App Store said I needed to switch countries so I clicked the button and it switched it for me but now I can't update my apps but when I try to change it through settings it still says the country is the u.s. I don't know what to do to change it back

    See  >  Change your iTunes Store country
    Here  >  http://support.apple.com/kb/HT1311
    If necessary Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Changing region position on submitting the page by clicking a  button.

    Hi,
    I have 3 regions in my APEX page.
    1. Region having 20 LOV's with the width between them as 300. The display point is "Page Template Body (1)"
    2. Region having 3 buttons.(Go, CLEAR,CALCULATE) The display point is "Page Template Body (2)" Template is "Region without title" and column = 2 and align = "center" in HTML table cell attributes
    3. Region having a report with 25 display columns.
    Now the problem is,
    a) When I click "GO" button , 25 column report displays and it goes beyond the page layout. Hence button also shifts to right(means center position of the page when it is extended by 25 column report). User cannot see the button.
    This button shpould retain its place. How to do this?
    b) When I click "GO" button , the gap between the LOV's increases and LOV's also shifts to the right side.
    These LOV should be in its place. and should not move on click of button when page submitted.
    How can i achieve this. ??
    Any suggestios would be welcome.
    Please help me.
    Thanks
    Alaka
    Edited by: Alaka on Jan 5, 2009 6:06 AM

    Hi,
    If I understand well your problem... You don't say what theme you are using, but usually regions have width=100%, meaning that they should use the whole width of the page (not just the visible part on the screen). Because of this, when the region containing the report extends to the right, it forces all other regions on the page to resize themselves accordingly, that is why your design is getting messed up.
    One way to fix it is to tweak the region templates (I would suggest making a copy instead of changing the existing templates). Simply remove the width=100% setting, or hardcode it to a fixed width (for instance, width=300px).
    It is a bit complicated to explain here exactly how to do this, but I hope this gives you an idea...
    Regards,
    Luis

  • Dynamic button change color on click and reset the unclicked buttons

    Hi,
    I have have 3 buttons created dynamically from JSON file.
    When I click on any of them the color is changed to red. (this is good).
    But when I am going to click another button the previous red that I have clicked earlier doesn't change to it's grey statement, except from the last button which is the only one that works (is changing between red and grey).
    If for the JSON make variable for the index e.g.(0,1,2) is working, but I want to make it work without index it. I want to make it with symbol's attr.
    here is the files if someone can give it a try.
    Dropbox - hover.rar

    At stageCreationComplete I have it as a function, but it doesn't work correct.
    I want to know why.
    The problem is that when I use getJSON, it creates the ChildSymbols and keeps in memory only the last record (index).
    So, I believe that I need to count the indexes of the JSON files and store it perhaps.
    What I mean.
    My JSON structure:
      {     "title" : "Central",
            "category": "",
        "image": "images/thumbs/models/central.png",
        "large": "auto-2f-kent-large/0.png",
            "frame": "frames-large/0.png",
             "jsonf": "auto2fk.json"
      {     "title" : "Telescopic",
            "category": "",
        "image": "images/thumbs/models/telescopic.png",
        "large": "auto-2f-til-large/0.png",
            "frame": "frames-large/0.png",
             "jsonf": "auto2ft.json"
      {     "title" : "Glass",
            "category": "",
        "image": "images/thumbs/models/glass.png",
        "large": "auto-glass-large/0.png",
            "frame": "frames-large/0.png",
             "jsonf": "autoglass.json"
    it has 3 index. And on ChildSymbol I give the attr as .attr("id", item.title);
    If I make index.length it will give me 3 as number.
    But if I make item.title.length it will count the letters of its Word, the result will be (7,10,5).
    How Can I make it to count the word itself an give me 3 as a result?

  • Can we remain in the same state even after clicking submit button?

    Hello All,
    Can we remain in the same stage even after clicking submit button? Also it should remain in the same stage only when certain conditions are met. For eg:
    Condition : In Stage1, CustomFieldA default value is 'No'. To pass from Stage1 to Stage2 the CustomFieldA value should be made to yes.
    Scenario 1 : CustomFieldA value is 'No', and I click on Submit .
    Expected Result : should remain in the same stage
    Is above result achievable in PS 2013? I am creating workflow in Visual Studio 2012, so can I handle this in the workflow?
    Please help.

    The above answer was proved wrong, so please follow this link to get the answer.
    http://social.msdn.microsoft.com/Forums/en-US/8c75d74d-1ea6-4273-96cd-e70f5a5688fc/how-to-remain-in-the-same-stage-even-after-clicking-submit-button?forum=project2010custprog

  • Where is the "firefox button" that is used to change tab location ("click on the Firefox button, go over to the Options... arrow and uncheck Tabs on Top. ")

    Where is the "firefox button" that is used to change tab location ("click on the Firefox button, go over to the Options... arrow and uncheck Tabs on Top. ") (from article).
    The "Tools" menu has an "Options" selection, but I cannot find in any of those menus a selection controlling the location of the tabs. Where is the "Firefox Button" referred to in the article "Why are tabs on Top?"

    If you turn on the classic menu bar, that replaces the orange Firefox button. To get the Firefox button back, right-click the menu bar to display the toolbars list, and uncheck Menu Bar.
    You can always temporarily display the classic menu bar by tapping the Alt key or pressing F10.
    The toolbar list pop-up also lets you control Tabs on Top.

  • I want to do banners ,how can we do  when click the same button (next button)  it must show differen

    i want to do banners ,how can we do  when click the same button (next button)  it must show different images . cam any one help

    Check out my blog with samples on Edgehero.
    http://www.edgehero.com/articles/interactivity

  • Playing basic sound ( *.wav ) through a click of button ?

    Hi Java experts:
    Need to know the Java code to be added to a click button 1 to play sound ( *.wav ) and the code to stop the sound through and other click of button 2.
    Using a normal applet
    Thank you in advance
    M C Benzerari

    See...the scenario is something like this : I have a main application running into a JFrame instance. Now, from a menu item in this JFrame, I have opened the modal JDialog. And from this modal JDialog, I have created a JFrame. Now I am not able to focus and perform any operation on this JFrame unless I close the JDialog from which it was created.
    Please suggest some workaround so that without closing the JDialog, I am able to fire some event from the JFrame which is being created from this modal JDialog.
    Thanks,
    Gauri

Maybe you are looking for

  • Can the included instruments with LPX be installed on a secondary drive?

    Hi Guys, I've just taken the plunge and purchased Logic Pro X - upon first opening, it shows a message that "Logic Pro X is currently downloading an essential collection of instruements... (etc)" I'm wondering if, once these are downloaded, it is pos

  • How to get OS X LION to clean install on late 2007 Black MacBOOK 1.3?

    I recently bought a late 2007 Black MacBOOK 1.3. Wanting to clean install LION, I formated the HDD and cleaned up the recovery partition by fusioning the two partitions! I had to install LION with the use of a friends account. This doesn't suit me be

  • Transaction Handling - JDBC Receiver Adapter - Multiple SP Calls

    Hello, I have the following scenario: I send an XML-SQL structure with multiple statment elements (each of them calling a different stored procedure). A stored procedure raises an error back to the JDBC Receiver Adapter in case of error. Is it possib

  • N8 apps make unwanted internet connection automati...

    Dear users, I have had my N8 for a week now. It's beautiful, but there is only one issue I cannot resolve. With my other Nokia's (also Vodafone as provider) I was able to set any internet connection manually by selecting "Always ask" in the phone's c

  • Flash, MP3 and Webcast on Mobile Devices

    Hello there, Please excuse my newbie-ness here. While I am completely green to the Mobile Development, I have been designing websites for many years. The company I work for right now has a long history in Audio Broadcasting, and currently webcast dai