keyboard-events

AS3 Keyboard Control

大憨熊 提交于 2019-12-11 04:34:02
问题 I've got an as3 function that controls a movie clip with the keyboard: package { import flash.display.MovieClip; import flash.events.KeyboardEvent; import flash.ui.Keyboard; import flash.events.Event; public class Main_Character_Two extends MovieClip { var vx:int; var vy:int; public function Main_Character_Two() { init(); } function init():void { //initialize variables vx = 0; vy = 0; //Add event listeners stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); stage.addEventListener

Why isn't the keyListener working?

天涯浪子 提交于 2019-12-11 04:33:32
问题 This is a pong game I made, but the only thing that is not working is the paddles moving. I am not sure how to make the keyboard work with the program. Here is the code for the main game: //Project: A program where you play the game pong //This module defines the properties of the user interface import java.awt.*; import javax.swing.*; import java.awt.event.*; public class pongframe extends JFrame { private JLabel playerlefttitle; private JLabel playerrighttitle; private JLabel speedtitle;

Silverlight - Button control tab stop twice mystery

大憨熊 提交于 2019-12-11 03:49:01
问题 I'm debugging a large Silverlight application and i'm finding on every form all button controls receive tab focus twice before going to next control. I cannot reproduce this behavior in a simple hello world application though. Interestingly this problem does not occur on HyperlinkButton controls in the same form, just Button. Any idea what would cause this, or some things to help me isolate the cause of this? Thanks in advance. [Edit] If I set the IsTabStop property to false then it just tabs

Enter key event not working on Numeric Input field?

我们两清 提交于 2019-12-11 03:49:00
问题 I created two EditText with these two property. android:digits="0123456789" android:inputType="numberDecimal" I use Hardware Keyboard, when I perform Enter Key, focus control not shifting from one view to next view, as it happen normal in EditText case. If I remove " android:digits " property then it work properly, but here it allow to insert decimal key also, that I don't want. I tried with " android:nextFocusDown " proerty also, but that is also not working in this case. Any one have idea

Using Matplotlib Slider and key_release_event concurrently

自古美人都是妖i 提交于 2019-12-11 03:19:48
问题 I am using Matplotlib (with 'tkAgg' backend) to display an image from a sequence of images. I have a Slider widget setup to allow me to scroll through the image sequence - moving the slider changes which image is being displayed. I also have an mpl_connect set to listen for key_relese_events specifically from the left and right arrow keys which calls the same on_change() method to either advance to the next image or show the previous image. Both of these are working fine independent of

Simple command-line app I/O in Dart

本小妞迷上赌 提交于 2019-12-11 02:42:41
问题 Is there a way of taking single character (integer) keyboard inputs from the user and storing them to a variable in a Dart command-line app? I've tried something like: Stream cmdLine = stdin .transform(new StringDecoder()) .transform(new LineTransformer()); StreamSubscription cmdSubscription = cmdLine.listen( (line) => (choice = line); cmdSubscription.cancel();); In an attempt to store a keyboard input into the variable 'choice' and many slight variations of this code but can't get it to work

Javascript How to use onclick function also with keyboard

旧巷老猫 提交于 2019-12-11 00:55:18
问题 I hope the title of the question fits to what I'm asking here. I have this code in HTML & javascript: <button id="Z">Z</button> var btnZ = document.getElementById("Z"); btnZ.onclick = function() { // Some code Ok, now I want to execute btnZ.onclick function when the user press "Z" on keyboard. How can I do this without duplicating the code inside btnZ.onclick function? 回答1: Use this: function clicked () { alert('clicked!'); //some code } document.onkeydown = function (e) { var keyCode = e

check keyboard state without using KeyboardEvent in AS3

。_饼干妹妹 提交于 2019-12-10 20:03:36
问题 Is it possible to check for pressed keys without using the KeyboardEvent? I have an ENTER_FRAME event setup called enterFrameHandler and I want to check within the function enterFrameHandler if any keys are pressed. normally when using a KeyboardEvent I could check for keys easily using a switch that checks the KeyCode of the event, but in an ENTER_FRAME event this isn't possible for me. Is there any other way of checking the keyboard's state within the ENTER_FRAME event? UPDATE: I found this

How do I detect the 'delete' key in my Field subclass?

一笑奈何 提交于 2019-12-10 18:35:11
问题 I'm trying to detect and override the Delete key on the Blackberry keyboard. For some reason, it never makes it inside my case statement as when it hits that point: Keypad.key(keycode) == 8 Keypad.KEY_DELETE == 127 What's my error? public class MyField extends ListField implements KeyListener { // ... /** Implementation of KeyListener.keyDown */ public boolean keyDown(int keycode, int time) { boolean retval = false; switch (Keypad.key(keycode)) { /* DELETE - Delete the timer */ case Keypad

How to detect shift + right arrow + some other key in angular

不问归期 提交于 2019-12-10 17:53:17
问题 I have a problem to detect shift + right arrow + p in angular. I am using angular 1.2.3 I have no problem to detect only right arrow + p but when the shift comes into game something brakes The question is hot to detect situation when 3 keys are pressed: SHIFT + RIGHT ARROW + P Here is a working example on plunker var app = angular.module('keyboardDemo', []); app.controller('MainCtrl', function($scope, $timeout) { /** * 39 (right arrow) * 80 (p) */ var map = {39: false, 80: false}; $scope