Dynamic keyboard-event

hello!
i want to make some dynamic buttons which are able to use by
pressing a letter and klick them. the problem is, that i try do
test it by using trace() and so on but there is no feedback by the
flesh when i pressed something. does anybody know what's wrong?
the event looks like that:
private function mausMarkiert(n)
n.currentTarget.alpha = 1;
// AENDERN --- hier noch die möglichkeit des
tastendrückens und exemplare verschiebens einbauen
container_kalkulator_variante.addEventListener(KeyboardEvent.KEY_DOWN,
reportKeyDown);
private function mausUnmarkiert(n)
n.currentTarget.alpha = .8;
the alpha-manipulation works. do i have to write something
more? container_kalkulator_variante is a sprite.
thanks for reading, understanding and re-writing!

so well. i've try it and it doesn't work and that make's me
sad.
so i will explain what's on my monitor and what's happaning
and what i want to do.
1) monitor
i've a container (a for example) with an container (b) and a
container (c). container (c) is my butten, and in it i have a big
sqare and some text.
2) what's happaning
++ when flash loaded everything and i move my mouse around
whithaut pressing it anywhere and after this i press a letter ...
nothing
++ when i pressed the mouse on anywhere exept (c) and after
this a letter ... nothing
++ when i pressed the mouse in (c), but not the text, and
after this a letter ... nothing (and this nothing is bad)
++ when i pressed the mouse in the text on (c) and after this
a letter ... i get a trace with the letter and it's character code
(like in the "f1"-help-example) --- but when i pressed with the
courser anything else after this eccept the text in (c) and use my
keyboard, again nothing happaned.
++++ this is the effect when i type
b.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
in a function for my "mouse over (c)" and it's also the
effect when i put this line after the first lines like
public class ...
public function ...
(right here)
the hole other buttom-stuff like manipulating alpha etc is
working - so the funcions and events are working like they should.
for me it seems like the is the need of something like "fokus" on
my (c)-container to become a reaktion for the keypressevent, but i
don't know if this is right and when how to do something like that.
3) the final user should be able to, for example, put 5
cookies from the first butten (c) to an other button (c') by drag
ond drop (c) over (c') by holding the keyboard-ding "5". so, for
this i think i need a mouse over (so that flash knows where the
cookies come from), a keyevent and after this a mousemoouveevent.
until now the user is not able to use the keyboard because i
have no code for it.
thank's for reading and for any, maybe, help

Similar Messages

  • Dynamic user events freeze user interface

    Hi all,
    I am having problem with dynamic user events.
    Dynamic user event is registered to the event structure, and many dynamic user events come in very fast, about every 30 ms. It freezes up the user interface, no response to mouse and keyboard, even after all user events finish execution.
    Any idea or work around?
    Thanks for any help.
    Anne

    Hi Anne,
    > Dynamic user event is registered to the event structure, and many dynamic user events come in very fast, about every 30 ms.
    The 30ms rate is not unreasonably fast as long as the processing for the event(s) can be completed in less than 30ms.
    What tasks are you doing in the User Event?
    For tasks that may take time to complete (like logging) you could queue up the data and send it to a consumer loop.
    > It freezes up the user interface, no response to mouse and keyboard, even after all user events finish execution.
    My *guess* here is that you got stuck in an event that never completed.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • Help with Keyboard Event

    Hi, I am designing a drum machine in flash pro Cs6 actionscript 3.0  and I am trying to add a keyboard event that will trigger a button event that I have all ready created, I can create the event to play the sound but this is not what I want, can I call the click event so the button will move on the key event triggering the sound, here is an example of one of my buttons code... btn, thank you if anyone can help.
    import flash.events.KeyboardEvent;
    playsound2.fla
    playsound with extra functionality:
    textbox added.
    Displays ID3 info of the sound
    btn.addEventListener(MouseEvent.CLICK, playSomeSound);
    function playSomeSound(e:MouseEvent)
              var req:URLRequest = new URLRequest("Savage.mp3");
              var s:Sound = new Sound(req);
              s.addEventListener(Event.COMPLETE, onSoundLoaded);
              s.addEventListener(Event.ID3, onID3Info);
    function onSoundLoaded(event:Event):void
              var localSound:Sound = event.target as Sound;
              localSound.play();
    function onID3Info(e:Event):void
              var id3Props:ID3Info = e.target.id3;
              var sOut:String = txt.text = "";
              for (var propName:String in id3Props)
                        sOut = propName + "=" + id3Props[propName] + "\n";
                        trace(sOut);
                        txt.appendText(sOut);
              txt.text = id3Props.comment;
    var ba:ByteArray = new ByteArray();
    var gr:Sprite = new Sprite();
    gr.x = 5;
    gr.y = 50;
    addChild(gr);
    var time:Timer = new Timer(50);
    time.addEventListener(TimerEvent.TIMER, timerHandler);
    time.start();
    function timerHandler(event:TimerEvent):void
              SoundMixer.computeSpectrum(ba, false);
              var i:int;
              gr.graphics.clear();
              gr.graphics.lineStyle(2, 0xFF0000);
              gr.graphics.beginFill(0x00ff00);
              gr.graphics.moveTo(10, 10);
              //  draw a circle.;
              var w:uint = 15;
              for (i=0; i<512; i+=w)
                        var t:Number = ba.readFloat();
                        var n:Number = (t * 200);
                        gr.graphics.drawCircle(i, 0, -n);

    Thanks, this was the code I added in the end and it works nicely, It covers my sound and id3 aswell as Im displaying lcd text in a dynamic text box.
    stage.addEventListener(KeyboardEvent.KEY_DOWN, btndownKey);
    function btndownKey(event:KeyboardEvent)
              if (event.keyCode == 83)
                        var url:String = "Savage.mp3";
                        var request:URLRequest = new URLRequest(url);
                        var s:Sound = new Sound();
                        s.addEventListener(Event.COMPLETE, completeHandler);
                        s.addEventListener(Event.ID3, onID3Info);
                        s.load(request);

  • Xcontrols and dynamic User Events

    Hi all,
    I'm trying to build a XControl with an Event Structure that accepts User Events generated by a separate parallel loop on the block diagram.
    A monitoring loop with its own Event Strucure on the block diagram seems to handle the User Events generated by my producer loop but the XControl seems to ignore the User Events.
    Example LabView 8.5.1 project is attached
    Any ideas?
    Attachments:
    XControl.zip ‏75 KB

    Hi Anne,
    > Dynamic user event is registered to the event structure, and many dynamic user events come in very fast, about every 30 ms.
    The 30ms rate is not unreasonably fast as long as the processing for the event(s) can be completed in less than 30ms.
    What tasks are you doing in the User Event?
    For tasks that may take time to complete (like logging) you could queue up the data and send it to a consumer loop.
    > It freezes up the user interface, no response to mouse and keyboard, even after all user events finish execution.
    My *guess* here is that you got stuck in an event that never completed.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • Flex 4 does not dispatch keyboard events for ENTER key.

    Hello everyone. I think I have a strange problem with Flex 4 Beta (4.0.0.8909). My application has had event listener for keyUp event for a month now and suddenly (two days ago) I've noticed that keyUp event is not dispatched for ENTER (ALT also) key. Anyone know why? By the way, I've tried this with keyDown event, also 4.0.0.8847 version of SDK - still the same: no keyboard events for ENTER (and ALT) key.
    Here is the sample application that has got this issue:
    <s:Application
       xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/halo"
       minWidth="640" minHeight="480"
       keyUp="application1_keyUpHandler (event)">
       <fx:Script>
          <![CDATA[
             import mx.controls.Alert;
             protected function application1_keyUpHandler (event: KeyboardEvent):void
                Alert.show ("Key up: " + event.keyCode);
          ]]>
       </fx:Script>
       <s:layout>
          <s:BasicLayout/>
       </s:layout>
       <s:TextArea verticalCenter="0" horizontalCenter="0" width="200"/>
    </s:Application>
    If you run this application and try typing anything in a TextArea you will get alerts with key codes. However, if you press ENTER (or ALT), you will get no alert.
    I'm pretty sure the code above is right so that means there is a bug in latest nightly builds of SDK (i would swhitch to an older build if i knew which one does not have this bug).
    Any ideas?

    Flex harUI wrote:
    That's true, but in this case, I think the text editing code is eating ENTER key in order to prevent parents from seeing it and acting on it (like a submit button).  We'll see if we can find a way around that.
    You can get the ENTER key now by listening in capture phase.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui
    The enter key isn't being disposed of by textedit, the attached example code works without error if you a- remove the alert box and b-set the focus to your text area on initialisation. I agree that pressing the enter key then calling a dialog box will result in the enter key being "gobbled up" as  the enter key is overridden by the dialog box code.
    I think the first suggestion should be to anyone don't use dialogboxes for testing code. If for some reason debugging isn't desirable instead of a trace statement a simple label  can be used as a 'fake' trace.
    David
    Message was edited by: David_F57: I worded this wrong, imho there is no need for a work around, the textarea component works as it should. When intercepting 'system' keycodes there is a need to consider the effect of the intercept and code appropriately to that end.

  • Keyboard Event Listener doesn't work in Browser

    Is there a reason why a keyboard event listener would not work if the flash is embedded in an HTML? The rest of my game is running fine in the background, but I can't launch the movieClip "nextCar." My code is below, if that makes any difference...
    function goNow (event:KeyboardEvent): void {
        thisOtherKey = event.keyCode;
        if (thisOtherKey == 32) {
            nextCar.gotoAndPlay(2);
            parkingQue.play();
            tries++;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, goNow);

    This may be a silly question, but have you tryed clicking on your swf after it opens up in the browser, and then trying the keyboard controls?
    I don't know of any issues that cause event listeners to workwhen debugging, but not in a browser.  So, I'm thinking maybe your just not focused on the swf.

  • Disablying keyboard events in a JFrame.

    Hello,
    How is it possible to disable keyboard events for a specific JFrame and then (after a while) enable events again ?
    thank you,
    Rami

    Look at this program, events are send but you can't see the data in the fields.
    import java.awt.*;
    import java.awt.event.*;
    public class Nok extends Frame
    public Nok()
         super();
         setBounds(6,6,400,300);     
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
                   dispose();     
                   System.exit(0);
         setLayout(new GridLayout(4,0));     
         add(new TextField("this is a text field"));
         add(new TextArea("this is a text area"));
         add(new Button("this is a button"));
         setVisible(true);
         Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener()
         {     public void eventDispatched(AWTEvent e)
                   System.out.println(""+e);
                   ((KeyEvent)e).consume();
         }   ,AWTEvent.KEY_EVENT_MASK);
    public static void main (String[] args)
         new Nok();  
    Noah
    import java.awt.*;
    import java.awt.event.*;
    public class Nok extends Frame
    public Nok()
         super();
         setBounds(6,6,400,300);     
         addWindowListener(new WindowAdapter()
    {     public void windowClosing(WindowEvent ev)
                   dispose();
                   System.exit(0);
         setLayout(new GridLayout(4,0));     
         add(new TextField("this is a text field"));
         add(new TextArea("this is a text area"));
         add(new Button("this is a button"));
         setVisible(true);
         Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener()
         {     public void eventDispatched(AWTEvent e)
                   System.out.println(""+e);
                   ((KeyEvent)e).consume();
         } ,AWTEvent.KEY_EVENT_MASK);
    public static void main (String[] args)
         new Nok();

  • In Flashplayer, I can crossover mouse and keyboard events. In IrfanView I cannot. Can this be fixed?

    My client uses IrfanView to play SWF files. Unfortunately, he does not use Flashplayer. In Flashplayer, I can crossover mouse and keyboard events with no problem. In IrfanView, the second I click a button, the keyboard events are disabled. Is there a fix?

    Hi Ned. I may have posted this issue a bit early, but this problem is also happening in Flashplayer 10. It's not exclusive to IrfanView.
    Here is something that I encountered during my testing, when I jump to scene 6 using the menu button, I have a play button to jump from one frame to the next frame that stops -- the keyboard events start working. But if all I am doing is jumping scene to scene with the mouse button, the keyboard events are disabled.
    I feel as if the keyboard events only work if I am playing frames in the scene. And if all I am doing is jumping scene to scene using the buttons, the keys will disable.
    I set up the mouse buttons inside a movieclip that all the scenes share. The mouse actionscript is in the movieclip. On the main timeline of each scene is an actionscript for the keyboard events, even though I had to change each function name.
    I feel the actionscript is setup pretty simple. I just wish clicking the buttons would not disable the keyboard events. This may sound redundant, but the keyboard events do the same thing if you use the mouse buttons. It's just preference for the client even though he will need to understand that using the mouse buttons override the keyboard events. He doesn't really lose functionality.
    Keyboard actionscripting below:
    import flash.events.KeyboardEvent;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyEvent);
    function onKeyEvent(e:KeyboardEvent):void {
    var character:String=String.fromCharCode(e.charCode);
    if (e.keyCode==72) {
      gotoAndStop(1,"master");
    if (e.charCode==49) {
      gotoAndPlay(1,"Distributor");
    if (e.charCode==50) {
      gotoAndPlay(1,"Mirka");
    if (e.charCode==51) {
      gotoAndPlay(1,"Farm");
    if (e.charCode==52) {
      gotoAndPlay(1,"Check2");
    if (e.charCode==53) {
      gotoAndPlay(1,"Check3");
    if (e.charCode==54) {
      gotoAndPlay(1,"Scene2");
    if (e.charCode==55) {
      gotoAndPlay(1,"Scene1");

  • Can we catch keyboard event triggered by an inputfiled?

    Hi all,
    I have a question here:
    When we are doing the web dynpro abap development, if I want to catch the keyboard triggered by an
    input help and handle it, how can I achieve this?
    e.g.   I have an inputfield on the UI,  if user click "F10" on the keyboard, can I catch this kind of event?
    Thanks and Regards,
    Aaron

    Hi Thomas,
    Yes, I'm trying to acomplish an input help for an inputfield.But, the free programmed value or OVS or dictionary search help can fullfill my needs.Here is the situation:
    I have a inputfield on the UI, and next to that , I have another textview, which should be changed according inputfield. e.g.  the inputfield is a user name, and next to that , is the user id. but we only want the input help for user name. so when user select one row iof the search result table, I want that two fields both filled.
    1. the OVS can't meet my need because I can't change the layout of the search result table, I need a table with a tree in it.
    2. free programmed value help can only send back the value of the inputfield. although maybe I can get the user_id's context attribute name and by hardcoding and send back also the user id. but I don't like hardcoding.
    So, I'm wondering whether I could catch the keyboard event. and handle the F4 help all by myself.
    Do you have some suggestion on this?
    Thanks and Regards,
    Aaron

  • Getting keyboard events on ALV grid

    Hi,
    I have an ALV Grid where it is possible to edit data. If user selects a row and presses delete/cut button with mouse event is triggered and I can access those events in code. Although if user selects a row and presses "Del" or "Ctrl + X" then I can't access those events in code. Is there a way to access keyboard events inside my code?

    Have a look at BCALV_GRID_EDIT -> if you select the first checkbox (p_cell = Update on cell change) then you will find that "data_changed" event can catch the line deletion via the keystrokes described.. in the event in this program, you could get the rows deleted from "rr_data_changed->mt_deleted_rows".
    if p_cell = 'X'.
      call method grid1->register_edit_event
        exporting
          i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    else.
    Jonathan

  • [solved] send keyboard event / key to specific background window?

    Hi!
    So... is this possible / how? I'd like to send keyboard events to a window in the background - maybe even in regular intervals. While I'm dong something else, in another window (or nothing).
    Thx!
    Last edited by whoops (2011-07-21 11:05:44)

    Actually I'm thinking, maybe there is a totally another (better?) way to do what you want. I usually find that automatizing tasks in linux differs very much from the windows experinece, most of the times scripting is the most powerful and easy way of doing things. So if you describe to us what you want to accomplish, maybe some experienced linux gurus would give you some advices that sets you off course from sending keys and mouse events. I used to do that in windows with autohotkey, but now in linux there was no need for that so far ever, except for using system wide abbreviations with autokey.

  • Handling keyboard events in applets?! Possible?!

    Hello,
    I wrote a little game that uses keyboard handling events. It is an applet that can also standalone as an application. When i run the program as a standalone application, it handles keyboard inputs fine. ie...i can press the left and right arrow keys and something happens.
    But when i run my program as an applet in a web browser, the applet starts up correctly but does not handle any keyboard events. It only handles mouse events. For instance, if i press the up and down arrow keys, the browser window scrolls up and down!!! And the up and down arrow keys have a specific purpose in my applet.
    QUESTION: how do i get my applet to accept keyboard inputs such as UP,DOWN, LEFT, RIGHT?

    Hmm something went wrong w/ my post so i hope this doesnt show up twice.
    Hey thanks a lot for helping me out. The applet/application is large so here is the main() method and the keyboard event handling class code. My question is how come the keyboard events get properly handled when i run it as a standalone application, but keyboard events go to the browser when i run it as an applet? I would post my entire code but it's over 1000 lines and spread out over 8 files. hehehe.
    Here is main():
      public static void main(String[] args)
          MyProgram applet = new MyProgram();
          applet.isStandalone = true;
          JFrame frame = new JFrame();
          frame.setTitle("Physics: Kinematics");
          frame.getContentPane().add(applet, BorderLayout.CENTER);
          applet.init();                        // initialize the applet inside frame
          applet.addKeyListener(kbHandler);     // kbHandler is a keyboard handling object
          applet.start();
          frame.setSize(APPLETWIDTH,APPLETHEIGHT);
          Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
          frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
          frame.setVisible(true);
          // private inner class to terminate the Application when frame closes
          frame.addWindowListener(
            new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
          frame.show();
       }"kbHandler" is the keyboard event handling object. It gets initialized in the applet.init() method.
    kbHandler = new BMkeyboardHandler();And here is the keyboard event handling code:
    // ===== keyboard event handler ===========
       private class BMkeyboardHandler implements KeyListener
            public void keyPressed(KeyEvent e)
                pushedKey = e.getKeyCode();
                // General administrative key actions
                if(pushedKey == KE.VK_H)
                    actionArea.toggleHelpMenu();
                    actionArea.repaint();
                else if(pushedKey == KE.VK_C)
                    actionArea.toggleCtrlMenu();
                    actionArea.repaint();
         }So there it is. Again, the program handles events fine as a standalone application. But running it as an applet in a browser (and even the appletviewer) doesnt let me handle keystrokes.

  • Dynamic user event

    Hello, I am a newbie regarding dynamic user events.
    Basically, I want to create a user event that triggers  an event structure in a subvi.
    To do this, I wire up a "create new user event" and then pass the refnum to my subvi "more info" as seen below.  But this piece of code get's stuck in the sub-vi and never leaves :[
    here is my subvi below:
    I'd greatly appreciate any help :]

    To stop your main vi you will need to provide a mechanism to stop your sub vi.
    I would use an additional boolean User Event to do this.
    (This could be shared among other subvis).
    When the (let's call it) Shutdown event is received, set your subvi while loop control terminal true.
    Note: When using this scheme in an exe file, if the subvi front panel is open and you shutdown the main vi, the subvi can remain open. This happened to me using LabVIEW 2010. I had to use a Front Panel Close Method to avoid this issue.
    When using the Front Panel Close Method you should first check if the front panel is open or not to avoid an error.
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • Detect mouse clicks or keyboard events on desktop or everywhere

    Hi,
    What I have to do is to start the application minimized in the system tray. Then the application must be listening for crtl+shift+left mouse click in any part of the desktop or an opened application, when that happens, I have to show a window asking if the user want to take a screenshot starting in the x,y point he clicked and then take the screenshot.
    What I don't know how to do is to detect the mouse and keyboard events when the application is supposed to be running minimized in the system tray.
    How can I do that? Can anybody give me a hint?
    Thanks in advance.

    It's not possible with plain Java. You will need native code for this. Take a look at JNA.

  • Listen Keyboard events in AIR for iOS? [HELP]

    It works in the browser...  Is there any way in AIR to do this for iOS ?

    Hi, this is an old post but it is related to issues that still in Adobe AIR 3.7, I have the same situation implementing an iCade controller, I have solved the problem creating an iCade proxy that use a hidden TextField to capture text change events that are mapped into keyboard events and finally dispatched to the game listener. This is the code so far, it works but is not optimized, im sure you can optimize and remove the useless code from here:
    package {
              import flash.display.DisplayObjectContainer;
              import flash.display.FocusDirection;
              import flash.display.Sprite;
              import flash.events.Event;
              import flash.events.KeyboardEvent;
              import flash.events.MouseEvent;
              import flash.events.TouchEvent;
              import flash.text.TextField;
              import flash.text.TextInteractionMode;
              import flash.ui.Keyboard;
               * ICadeProxy
               * @author Juan Fernando Vélez Melguizo - © Copyright 3DLogical - www.3dlogical.com
              public class ICadeProxy extends Sprite {
                        private var fireKeysDown:String = "yuihjk";
                        private var fireKeysUp:String = "tfmrnp";
                        public var inputField:TextField;
                        public function ICadeProxy() {
                                  if (stage) {
                                            init();
                                  } else {
                                            addEventListener(Event.ADDED_TO_STAGE, init);
                        private function init(e:Event = null):void {
                                  removeEventListener(Event.ADDED_TO_STAGE, init);
                                  inputField = this.inputFieldSource;
                                  initKeyboardCapture();
                        public function initKeyboardCapture():void {
                   inputField.text = "";
                                  inputField.addEventListener(Event.CHANGE, doKeyChange);
                                  inputField.addEventListener(Event.DEACTIVATE, doRefocus);
                                  inputField.addEventListener(MouseEvent.CLICK, doClick); // This is for debug only
                                  recoverFocus();
                        public function doClick(e:MouseEvent):void {
                                  trace("CLICKED ME:" + e.currentTarget);
                        public function dispose():void {
                                  inputField.removeEventListener(Event.CHANGE, doKeyChange);
                                  inputField.removeEventListener(Event.DEACTIVATE, doRefocus);
                                  stage.focus = null;
                        private function doRefocus(e:Event):void {
                                  recoverFocus();
                        public function recoverFocus():void {
                                  stage.focus = this;
                                  stage.focus = inputField;
                                  inputField.dispatchEvent(new MouseEvent(MouseEvent.CLICK, false, false, 384, 512, inputField));
                                  inputField.text = "";
                                  inputField.requestSoftKeyboard();
                        private function doKeyChange(e:Event):void {
                                  var t:String = inputField.text;
                                  var k:String = t.charAt(t.length - 1);
                                  var eventType:String = "";
                                  var newKey:uint = 0;
                                  if (k == "w") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.UP;
                                  if (k == "x") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.DOWN;
                                  if (k == "a") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.LEFT;
                                  if (k == "d") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.RIGHT;
                                  if (k == "e") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.UP;
                                  if (k == "z") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.DOWN;
                                  if (k == "q") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.LEFT;
                                  if (k == "c") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.RIGHT;
                                  if (k == "o") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.Q;
                                  if (k == "l") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.P;
                                  if (fireKeysDown.indexOf(k) != -1) {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.SPACE;
                                  } else
                                  if (fireKeysUp.indexOf(k) != -1) {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.SPACE;
                                  stage.dispatchEvent(new KeyboardEvent(eventType, true, false, 0, newKey));

Maybe you are looking for