How to add keyboard interaction?

I got 16 different buttons in this application, each button playing different kind of sound. Currently i only able to use mouse click to start playing sound, and click again to stop, but now i wish to add shortcut key to access those track buttons, like pressing "q" for track 1, "w" for track 2. Pressing "q" for the first time will start the sound and animation, press again will stop the sound and animation. Currently I've implemented this code, there are no errors but it won't work somehow, what is the problem?
private var _ambientTracks:Array = [ambient1, ambient2, ambient3, ambient4];
private var _effectTracks:Array = [effect1, effect2, effect3, effect4];
private var _melodyTracks:Array = [melody1, melody2, melody3, melody4];
private var _beatTracks:Array = [beat1, beat2, beat3, beat4];
//handle click on track invoke  start / stop functions
private function onTrackClicked(event:MouseEvent):void {
    var track:Sprite = event.currentTarget as Sprite;
    var trackName:String = track.name;
    if (trackName in _playingTracks) {
        stopTrack(track);
        delete _playingTracks[trackName];
    } else {
        startTrack(track);
        _playingTracks[trackName] = trackName;
//starts track animation and dispatch event for TrackMixer
private function startTrack(track:Sprite):void {
    Actuate.tween(track, 0.6, {alpha: 0.3}).reflect().repeat();
    dispatchEvent(new ObjectEvent(START_TRACK, track.name, true));
//stop track animation and dispatch event for TrackMixer
private function stopTrack(track:Sprite):void {
    Actuate.stop(track, "alpha");
    track.alpha = 1;
    dispatchEvent(new ObjectEvent(STOP_TRACK, track.name, true));
//trigger keyboard shortcut
   public function setup(stage:Stage):void {
        stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
    private var bool:Boolean = false;
    private function keyDown(event:KeyboardEvent):void {
        var track1:Sprite = Sprite(String(ambient1));
        if (event.keyCode == 81) {
            if (bool == false) {
                startTrack(Sprite(track1));
                _playingTracks[track1];
                bool = true;
            } else {
                if (bool == true) {
                    stopTrack(Sprite(track1));
                    delete _playingTracks[track1];
                    bool = false;

Actually i just want to addEventListener to the keyDown and define the keyDown function, even i use trace it also doesn't show up anything, that mean the keyCode == 81 is actually not working, do you have any idea or other way to make sure the keyCode is working?

Similar Messages

  • How to add keyboard control key to menu bar as shown

    how to add keyboard control key to menu bar as shown bellow
    Please help

    why, nobody can give me any suggestion?!
    I want to know how to get the specific Control from the Line which does not has this kind of Control. Currently, I met this problem -- the line does not support EnumControl.Type.REVERB, however, I want to exert the reverb control to the line.
    please. thank you very much!

  • How to add keyboard control on our tree.

    hi,
    any body can kindly tell me that how can we add keyboard control on out tree widget.
    I am also anxious to know that when I compiled and loaded the PnlTreeView sample in Debug mode, keyboard control on this panel was also not working fine, it worked sometime and not on the other.
    Can anybody help me for the above 2 questions.

    There's no calendar control per-se, but you have an option - create an HTML image-map prompt - that should work....the only problem would be making it dynamic, but I'm sure you can create a big image map

  • [SOLVED] How to add keyboard shortcuts in XFCE?

    I'm giving XFCE a try lately after all of the changes I'm seeing, I'm trying to add a new shortcut to ease some tasks but I don't have a clue on how to do it.
    I go to Settings -> Keyboard and there to "Application shortcuts". Then I  select to add a new one and point to the script I want to run, but I don't have a clue on how to select the shortcut. I've tried pressing the keys I want to bind, but no way.
    This is what I'm seeing:
    How to choose the actual shortcut?
    Last edited by KaoDome (2012-05-11 13:16:03)

    It is the next screen   Pick the command, click OK.  It then throws up a box telling you to press the key combination.  It will show as you push meta, shift and control modifiers.  When you hit a character that generates a keystroke, it saves it, along with the modifiers.

  • How to add keyboard layout and define shortcut to switch layouts

    Hello there people of Arch!
    How can i add greek layout to my laptop and how can i set "alt+shift" as the shortcut to switch between layouts?
    I tried to search but i couldn't find something useful!

    Inxsible wrote:
    sepuku wrote:
    Inxsible wrote:What I gave you there was the guide itself.
    What you gave me there is something generic not a guide(telling do "this" and "that" without telling how "this" and "that" is actually done is not a guide).Since i ask you how i'm supposed to do something am asking for specific info.
    I'm using gnome.Is there a way to do it using the graphical environment?I don't have time this days to learn writing scripts cause i really need the greek layout for my studies and there's little time.
    Thank you again for your reply!
    Aah !!
    Why didn't you say you wanted everything handed out to you on a platter !!!
    Aaaah why didn't you say you are full of complexes?Thank you for your guide!That really helped me!I just asked if there's is guide in the forum 'cause i searched and couldn't find any info.And no what you gave me is not a guide.Could you just answer this without pretending the smart?Or this is just to difficult?Well anyway no hard feelings I don't care.
    Am not going to reply to anything else you say cause you are ironic!I'll just wait if there is a more polite answer!
    Peace to your complexes.

  • How to add a interactive drop-down list

    I want a drop-down list that will add a set of required fields based on the choice from the list.
    In this case, we want users to fill in their job title, and based on that title selected we need them to fill in specific licensing information. I haven't found a javascript (or I don't have the expertise) to make this happen. I have done forms in the past that would just hide unneeded fields, but is there a way to actually have the fields become active, or appear based on the list selections? 

    Yes, it's possible. The general code would be something like this (as the drop-down field's custom validation script):
    var field1 = this.getField("FieldName1");
    var field2 = this.getField("FieldName2");
    var field3 = this.getField("FieldName3");
    if (event.value=="Value1") { // Show field1, hide the rest
         field1.display = display.visible;
         field2.display = display.hidden;
         field3.display = display.hidden;
    } else if (event.value=="Value2") { // Show field1 and field2, hide the rest
         field1.display = display.visible;
         field2.display = display.visible;
         field3.display = display.hidden;
    } else if (event.value=="Value3") { // Show all fields
         field1.display = display.visible;
         field2.display = display.visible;
         field3.display = display.visible;
    } else { // hide all fields
         field1.display = display.hidden;
         field2.display = display.hidden;
         field3.display = display.hidden;
    PS. Make sure you tick the option to commit the selected value of the drop-down field immediately (under the field's Properties - Options).

  • How to add table in SAP Non interactive forms in webdynpro java

    Hi Experts,
    I have a requirement in webdynpro java.I have a print button.On clicking print button a pdf will be opened.
    This pdf will have data from the webdynpro view.I want to know how to add table in the adobe pdf.The webdynpro view will have many rows of table(rows will keep changing as per the size of the data output).How to send this data to adobe.How do we bind the node to the table in the adobe.How to automatically
    Please suggest.
    Thanks,
    Rajani
    Edited by: Rajani Nandagiri on Dec 26, 2008 8:58 AM

    Rajani,
    Take a look at below links, it will help you.
    [Handling Dynamic Length Tables in Adobe Forms|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0859ad1-53aa-2a10-78ae-99e41c407669]
    [Integrate tables & Images in Adobe Web Dynpro|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20java/wdjava%20archive/dynamic%20non-interactive%20pdf%20form.pdf]
    [How to Handle Table Input and Output|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20java/7.0/adobe/how%20to%20handle%20table%20input%20and%20output.pdf]
    [How Tou2026deal with Table input and display in Interactive Forms|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00c4041d-188d-2910-6ea2-b4d5155f56e0]
    Chintan

  • How to add a link to an interactive svg using edge commons library

    Hi,
    I've been playing around with this wonderful Edge Commons interactive SVG tutorial
    My question is : How to add an external link "url" to an interactive svg using edge commons library ?
    Edge commons example file :
    http://edgedocks.com/market/interactive-svg-example-project-edge-commons
    Edge commons  video tutorial :
    http://www.youtube.com/watch?v=4UEB6gaLKuw
    I have adapted this tutorial to an interactive map, http://madudesign.com/works/france/ every thing is going fine until I couldn't figure out to link a particular url on each part of the region of the map.
    I managed to figure out how to change colors on the different parts of the map on mouse over and mouse out but I'm not quite comfortable with JavaScript since I don't use it every day...
    I have tryed to link to an url by passing it on the illustrator layer and via the onclick event (event.target.id) to a simple url
    http://redpen.io/6svh5u
    then working in Edge and publishing on the browser the link returns me a weird url line by replacing the original url slashes "//" by "_x2F_" and I must have misunderstood the proper JavaScript line to open that link from there...
    for example on my actual exemple "http://madudesign.com/works/france/"
    the first top region of France is normally a link to "http://www.google.com" and it returns "http:_x2F__x2F_www.google.com" plus the complete path to the file too...
    I don't know how to get around this trick and have back for each region a particular clean link from the event target id of the svg...
    thank-you for any help
    matt
    link to my edge animate file if needed :
    http://madudesign.com/works/france/carte_de_france.zip

    I got an answer from the Edge Commons dream team and I am very grateful to them :
    "The problem that you bumped into was that you hadn't included a valid URL so far. We weren't sure if you wanted to include them within the SVG file or if you wanted to implement the functionality within Edge Animate. We came up with a solution for the latter one, with a simple switch in the js code:
    You have to type in the appropriate URL of course for all the cases."
    I have to share the final result:
    http://www.madudesign.com/works/france/france_map/
    And the zipped project file:
    http://www.madudesign.com/works/france/france_map.zip
    Thanks to Daniel & Simon
    Matt

  • How to add new product in interactive demand planning(IDP)

    Hi gurus,
    How to add new product in interactive demand planning(IDP), can you suggest me, when i click data view in IDP, it will show new product.
    Regards
    babu

    Hi Raj,
    Since the New Product is already in MPOS what you need to do in your Data view is to go to "Selection Window" on the left side of the screen(make sure you dont click on the existing selection ids). Select Product at the top, the planning version will come in the next row and then you again select the Product as charateristic and enter the New product name against the Product(Characteristic) and then save it in case you want it to use for your future references. When you will double cilck on the newly made selection id you will be able to see you product with the keyfigure details in right side.
    Please let me know if it works.
    Thanks,
    Anand.

  • How to add Multimedia Keyboard Shortcuts

    Brand new to mac/apple...
    I use a wireless keyboard and mouse and want to use the multimedia keys on this keyboard. How do i add keyboard shortcuts in 10.5.5?

    f0rgiven wrote:
    Is there a way to verify the OS sees the "extra" keys on the keyboard (the mouse also has some extra buttons that i would like to assign but i want the keyboard first)?
    Go to the system preference mentioned in my earlier post & follow the instructions it provides to try to assign an application-specific shortcut to one of the "extra" keys (which will require one of modifier keys to be pressed along with it). If it recognizes the key, you will see some symbol for it in the second box, along with one for the modifier key. (The modifier keys are the shift, option, etc. keys that don't do anything by themselves).
    You might also check Logictech's website for software that supports the keyboard with OS X.

  • How to add bangla keyboard

    I am live in Bangladesh and I u am use iPhone 4s Ios 7.1.2 . I need bangla keyboard how to add bangla keyboard.

    Try the Keyman app.

  • How to add welsh keyboard to my iphone?

    Its easy to change the basic languages like English, Chinese, or other similar languages.
    But how can i find Welsh to add to my keyboard?

    It's not possible to add keyboards to iOS devices yet, but you can ask Apple for this feature via
    http://www.apple.com/feedback
    In the meantime, search the app store for "welsh" to see if someone has made a keyboard app for that language that might be useful for some purposes.  Some apps like Unicode Pad and Unikey let you create a sort of custom keyboard which lets you create text for copy/paste, etc.
    One way would be to use a wireless keyboard with the iphone.  There you can select the US Extended keyboard layout which lets you type the extra characters required, â, ê, î, ô, û, ŵ, ŷ and any other accents. 
    Even with the English screen keyboard,  all but the last two are already available by just holding down the key for the base letter.  You could create keyboard shortcuts for the two remaining special characters, ŵ, ŷ,  in settings > general > keyboard > shortcuts.
    Display of Welsh is no problem, and you can have a Welsh calendar via the Region Format settings.

  • How to add actions to keyboard?

    Hello I´ve been looking around the net, and found a lot
    of confusing information.
    I would like to know how to add simple actions like
    gotoAndPlay("next"); to a key.
    e.g. the right arrow.
    How could I do this? any simple way?
    thanks in advance, marcelo.

    In AS3 you can just use:
    if(event.keyCode == Keyboard.A)
    help doc:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/ui/Keyboard.html
    In AS2 you can use:
    if(String.fromCharCode(Key.getCode()) == "a")
    help doc:
    http://help.adobe.com/en_US/AS2LCR/Flash_10.0/00001143.html#300959
    That way you don't have to look up the key codes.

  • How to add interaction to button that only appears in selected state of radio button?

    Hi all,
    This is my first time working with flash catalyst, so far it's going pretty good. There is only one thing that I cannot get the program to do:
    I'm creating a quiz and I want a button to appear when the correct radio button is clicked. I've succeeded in making the button appear by putting it in the selected state of the correct radio button. But when I try to add the interaction 'go to next page' to this button, it doesn't work. It appears that the button is getting the same properties as the radio button it's connected to. When I put the button on the page and make it constantly visible (by taking it out of the selected state of the radio button), it does work.
    Can anybody tell me what I am doing wrong?
    Thank you very much,
    Sisko

    Hi there,
    For interactions, you can only target items within the current document (the object you are editing in place), or the top level application.
    Panini is a bit more flexible with interactions, so you may want to try that out.
    -Bear

  • How do I Create interactive images to be used in another website?

    Our office is contracted with a simple website company, so from the begining the framework is there. I want to add an interactive map that has each county hyperlinked to information about that area. I was told that Dreamweaver is the program I would need in order to create it.
    So, I have the program now but every tutorial I read is about making your own website in dreamweaver and I can't find anything about how to create the image to upload into a different website.
    Anyone know how to do this????
    Thank you!

    This helps, thanks. I have the content on the web page (where the hyperlinks will attach to), I have the image of the map, and I am making the shapes for the hotspots, just not how to get it all to link up.
    Also, when I saved a trial (just to make sure it would all work) it doesn't successfully upload as an image onto the website, just a little box with a red X. Any more thoughts anyone? 

Maybe you are looking for