![]() |
|
||||||||||
|
|||||
|
Регистрация: Oct 2009
Сообщений: 53
|
сделал класс для прослушивания нажатия и отпускания клавиш.
функция перехвата нажатия кнопки выглядит так: public function F_key_down(a:KeyboardEvent):void{ var V_key_press_code:int = a.keyCode; if(V_key_press_code == Keyboard.RIGHT) { } 1120: Access of undefined property Keyboard. что я делаю не так? =) |
|
|||||
|
Banned
[+4 25.09.09]
[+1 12.11.09] [+4 12.12.09] Регистрация: Sep 2009
Сообщений: 231
|
Возможно, Вы забыли написать
|
|
|||||
|
Регистрация: Oct 2009
Сообщений: 5
|
если всё же не сработает, то укажите код клавиши напрямую- стрелка вправо 39.
V_key_press_code == 39 |
|
|||||
|
это плохой путь. лучше через константы
__________________
я могу стать всем, если только захочу |
|
|||||
|
Регистрация: Sep 2009
Сообщений: 18
|
Вот и я считал, что это плохой путь. Но что-то не могу никак сделать по-хорошему, потому что Keyboard.LEFT работает например, а вот Keyboard.A - никак. Не компилируется такой код.
|
|
|||||
|
...
модератор форума
Регистрация: Sep 2006
Адрес: Minsk
Сообщений: 4,286
|
package by.typing.utils { import flash.ui.Keyboard; /** * @author Vitalik Sosnovski */ public class MyKeyboard { public static const BACKSPACE:uint = 8; public static const TAB:uint = 9; public static const ENTER:uint = 13; public static const SHIFT:uint = 16; public static const CONTROL:uint = 17; public static const CAPS_LOCK:uint = 20; public static const ESC:uint = 27; public static const SPACE:uint = 32; public static const NUMBER_0:uint = 48; public static const NUMBER_1:uint = 49; public static const NUMBER_2:uint = 50; public static const NUMBER_3:uint = 51; public static const NUMBER_4:uint = 52; public static const NUMBER_5:uint = 53; public static const NUMBER_6:uint = 54; public static const NUMBER_7:uint = 55; public static const NUMBER_8:uint = 56; public static const NUMBER_9:uint = 57; public static const A:uint = 65; public static const B:uint = 66; public static const C:uint = 67; public static const D:uint = 68; public static const E:uint = 69; public static const F:uint = 70; public static const G:uint = 71; public static const H:uint = 72; public static const I:uint = 73; public static const J:uint = 74; public static const K:uint = 75; public static const L:uint = 76; public static const M:uint = 77; public static const N:uint = 78; public static const O:uint = 79; public static const P:uint = 80; public static const Q:uint = 81; public static const R:uint = 82; public static const S:uint = 83; public static const T:uint = 84; public static const U:uint = 85; public static const V:uint = 86; public static const W:uint = 87; public static const X:uint = 88; public static const Y:uint = 89; public static const Z:uint = 90; public static const SEMICOLON:uint = 186; public static const EQUAL:uint = 187; public static const COMMA:uint = 188; public static const MINUS:uint = 189; public static const PERIOD:uint = 190; public static const SLASH:uint = 191; public static const BACKQUOTE:uint = 192; public static const LEFTBRACKET:uint = 219; public static const BACKSLASH:uint = 220; public static const RIGHTBRACKET:uint = 221; public static const QUOTE:uint = 222; public static function get capsLock():Boolean { return Keyboard.capsLock; } public static function get numLock():Boolean { return Keyboard.numLock; } public static function isAccessible():Boolean { return Keyboard.isAccessible(); } } } |
|
|||||
|
Регистрация: Sep 2009
Сообщений: 18
|
Хм, спасибо, как раз начал писать аналогичный класс
![]() |
|
|||||
|
Спасибо за класс, утащу себе.
__________________
Тут мужик танцует и поёт про флэш |
![]() |
![]() |
Часовой пояс GMT +4, время: 02:47. |
|
|
« Предыдущая тема | Следующая тема » |
|
|