prev | index | next

MX-Key events
6
12
438 bytes
1142 bytes
2004-01-17 00:00:00
2004-01-17 19:48:36
Oldes (oliva.david@seznam.cz)


to test onKeyDown and onKeyUp events

I made this example to test how is working the onKeyUp event under Linux version of Flash. I can say that it's working but sometimes is not received if you press more keys at once. Under M$ it's working up to 3 keys at once.

(mx-keyevents.rswf)
fnt_ArialN: font [name "_typewriter" bold]
txt_testField: EditText test 319x19 [
    Font [fnt_ArialN 11] border
    noSelect ReadOnly
    text "Press any key here..."
]
place txt_testField
doAction [
    keyListener: make object! []
    keyListener.onKeyUp: func[][
        test: rejoin [
            "onKeyUp:  "
            " ascii=" (Key.getAscii())
            " code="  (Key.getCode())
            " key=" (to-char (Key.getAscii()))
        ]
    ]
    keyListener.onKeyDown: func[][
        test: rejoin [
            "onKeyDown:"
            " ascii=" (Key.getAscii())
            " code="  (Key.getCode())
            " key=" (to-char (Key.getAscii()))
        ]
    ]
    Key.addListener(keyListener)
]
showFrame
end