Getting a Behavior class to respond to specific key presses
Hello,
My Problem is this:
I have a keyboard behavior class which extends the behavior class, i want the behavior to wakeupOn a specific key press, ie KeyEvent.VK_UP, however, the class will only seem to respond to the the KEY_PRESSED, KEY_RELEASED and KEY_TYPED variables.
Any help on how to get the behavior to wake up on specific key presses would be gratefull.
Paul
The normal event model, as far as I can tell, is to wake up on keypressed and then check which key it was that has been pressed and respond accordingly.
Similar Messages
-
How to get keyReleased() to always only respond to one key?
I want a picture to move right when hold the right arrow key down. However, I want the picture to stop moving right when I release it. So, first I check the keyCodes to make sure its the right arrow key.
However, if I hold down the right arrow key, and then I press and release any other key, and then I release the arrow key, then the keyReleased code for the right arrow key doesn't happen.
Is there a simple way to fix this?Are you using Swing (you don't mention if it's Swing, AWT, SWT,...)? If so, you probably want to use Key Bindings. The best source of information for this is in the Sun Java Swing tutorials: [How to Use Key Bindings|http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html] .
If you want to distinguish between key press and release, you'll need to look into the [KeyStroke API|http://java.sun.com/javase/6/docs/api/javax/swing/KeyStroke.html] .
Good luck. -
How to create an EventListener for a specific keyboard press?
Hello,
I have been trying to figure out how to switch my actionscript3 from a mouse click to a keyboard press. I'm new to Flash, but the problem I keep coming to is that I need to have 3 separate keys programmed in to do three seperate outcomes. I have messed around with eventListeners for keyboard presses, but I cannot figure out how to have flash listen for a specific key press and then do an action based on that specific key press.
Here is my actionscript. Any suggestions on how I can modify the mouse clicks to be keyboard presses, where key 's' = btn1 and triggers gotoAndPlay(2), 'g' = btn2 and triggers gotoAndPlay(3), 'k' = btn3 and triggers gotoAndPlay(4) as outline below. I also need my timer and writing to an exteral file to remain the same.
stop();
var startTime:Number=getTimer();
var elapsedTime:Number;
stream.writeUTFBytes("Item1,");
function BTN1Action(eventObject:MouseEvent) {
elapsedTime = getTimer() - startTime;
stream.writeUTFBytes("Tar1,");
stream.writeUTFBytes(elapsedTime.toString());
stream.writeUTFBytes("\n");
gotoAndPlay(2);
function BTN2Action(eventObject:MouseEvent) {
elapsedTime = getTimer() - startTime;
stream.writeUTFBytes("Tar2,");
stream.writeUTFBytes(elapsedTime.toString());
stream.writeUTFBytes("\n");
gotoAndPlay(3);
function BTN3Action(eventObject:MouseEvent) {
elapsedTime = getTimer() - startTime;
stream.writeUTFBytes("Tar3,");
stream.writeUTFBytes(elapsedTime.toString());
stream.writeUTFBytes("\n");
gotoAndPlay(4);
BTN1.addEventListener(MouseEvent.CLICK, BTN1Action);
BTN2.addEventListener(MouseEvent.CLICK, BTN2Action);
BTN3.addEventListener(MouseEvent.CLICK, BTN3Action);
Any assistance with this is greatly appriciated.Assuming you want to monitor key press on the button BTN1, you can do following:
// Add a key up event listener on the button (or on the source where the key press needs to be captured)
BTN1.addEventListener(KeyPress.KEYUP, BTN1KeyUpAction);
// BTN1KeyUpAction sample, you can modify this
function BTN1KeyUpAction(e:KeyboardEvent):void {
if(e.keyCode == Keyboard.S) {
gotoAndPlay(2); -
On my Mac Pro how can I get voiceover to start reading at a specific point in a document, and then continue on to the next paragraph and so on? Thank you. Ed
Welcome to the Apple family!!!!
How can I cause the VO cursor(box) show-up/start?
Press Control-Option and F5. The F5 key is located on the top row of keys 6th key over. This is a toggling "Keyboard Shortcut" for turning VoiceOver on and off.
How can I move the VO cursor to various sentences or paragraphs of an article and have it start reading ... and perhaps even continue reading on to the next paragraph(s) ... even to the end of the article?
How to read a website with VoiceOver
Step 1: Go to the Website
A quick keyboard shortcut is Command-L. This will jump you up to the address bar. Start typing where you want to go. i.e "www.thewebsite.com"
Step 2: Working with Webpage
VoiceOver will automatically start reading the website. You can pause the speech by hitting the 'Control Button'.
If VoiceOver does not being reading the webpage, then you might have to "Interact" with it. If VoiceOver say "HTML Content" then press Control-Option-Space-Down Arrow to interact with the webpage.
Use Control-Option-Right Arrow to move throught the website. This will speak "EVERYTHING" on the page.
Most website that I've found have their articles labeled as 'Heading'. You can jump from heading to heading, by pressing Control-Option-Shift-H.
If you'd like an itemized alphabetical listing of the site, press Control-Option-I
Press Control-Option-Space on the link or article you want to view.
Step 3. Reading from Top to Bottom
Once you found and clicked on the the article/link, use the same 'Heading' command, Control-Option-Shift-H to find the title.
After finding the title, press Control-Option-A will start reading from the title on.
Note: If there are any other items (ads, pictures, etc) it will read those too.
Tip: You might be able to activate a feature called the 'Reader'. The Reader isolates the article and elimanates the ads The keyboard command is Shift-Command-R. You can also find it in the Menu Bar (Command-Option-M) under the word 'View' then 'Show Reader'.
I am using a MACPro with OSX, probably Mavericks 10.9 (where would I look to see if that is the correct information?)
You can find this information under the 'Apple menu' in the Menu Bar. To access the Menu Bar, press Control-Option-M.
Go to Apple Menu > About This Mac. This will open up another window. Use Control-Option-Right Arrow until you hear 'Version'. If you purchased it brand new from Apple within the last six month, more than likely you have Mavericks.
Recommanded Articles.
AppleVis- Commonly used Keyboard Commands
Chapter 2: Learning VoiceOver Basics
Chapter 6: Browsing the internet
Apple Accessibility Resource Page
The 'Commands Help' Voiceover Menu. Control-Option-H-H. (hit H twice) is my best friend. It's a searchable VoiceOver Menu with most of the VoiceOver command. Example: You are looking for the 'Read Current Paragraph' keyboard command. Press Control-Option-H-H and then type Paragraph. It will then bring up all the commands with the word paragraph. I believe there are three.
As from the Trackpad Commands, I've copied and pasted below from Appendix A: Commands and Gestures
VoiceOver standard gestures
If you’re using a Multi-Touch trackpad, you can use VoiceOver gestures. VoiceOver provides a set of standard gestures for navigating and interacting with items on the screen. You can’t modify this set of gestures.
NOTE:Gestures that don’t mention a specific number of fingers are single-finger gestures.
General
Enable the Trackpad Commander and VoiceOver gestures
VO-Two-finger rotate clockwise
Disable the Trackpad Commander and VoiceOver gestures
VO-Two-finger rotate counterclockwise
Turn the screen curtain on or off
Three-finger triple-tap
Mute or unmute VoiceOver
Three-finger double-tap
Navigation
Force the VoiceOver cursor into a horizontal or vertical line when you drag a finger across the trackpad
Hold down the Shift key and drag a finger horizontally or vertically
Move the VoiceOver cursor to the next item
Flick right
Move the VoiceOver cursor to the previous item
Flick left
Move content or the scroll bar (depending on the Trackpad Commander setting)
Three-finger flick in any direction
Go to the Dock
This gesture moves the VoiceOver cursor to the Dock wherever it’s positioned on the screen
Two-finger double-tap near the bottom of the trackpad
Go to the menu bar
Two-finger double-tap near the top of the trackpad
Open the Application Chooser
Two-finger double-tap on the left side of the trackpad
Open the Window Chooser
Two-finger double-tap on the right side of the trackpad
Jump to another area of the current application
Press Control while touching a finger on the trackpad
Interaction
Speak the item in the VoiceOver cursor or, if there isn’t an item, play a sound effect to indicate a blank area
Touch (includes tap or dragging)
Select an item
Double-tap anywhere on the trackpad
You can also split-tap (touch one finger and then tap with a second finger on the trackpad)
Start interacting with the item in the VoiceOver cursor
Two-finger flick right
Stop interacting with the item in the VoiceOver cursor
Two-finger flick left
Scroll one page up or down
Three-finger flick up or down
Escape (close a menu without making a selection)
Two-finger scrub back and forth
Increase or decrease the value of a slider, splitter, stepper, or other control
Flick up (increase) or flick down (decrease)
Text
Read the current page, starting at the top
Two-finger flick up
Read from the VoiceOver cursor to the end of the current page
Two-finger flick down
Pause or resume speaking
Two-finger tap
Describe what’s in the VoiceOver cursor
Three-finger tap
Change how VoiceOver reads text (by word, line, sentence, or paragraph)
Press the Command key while touching a finger on the trackpad
Rotor
Change the rotor settings
Two-finger rotate
Move to the previous item based on the rotor setting
Flick up
Move to the next item based on the rotor setting
Flick down
To customize other gestures by assigning VoiceOver commands to them, use the Trackpad Commander.
Assigning VoiceOver commands to gestures
If you need a reminder about what a gesture does, press VO-K to start keyboard help, and then use the gesture on the trackpad and listen to the description.
Learning about keys, keyboard shortcuts, and gestures
Sorry lots of information. Enjoy. You -
I 'm getting message "Mozila Firefox not responding." It takes minutes to down load a site - some times just gets in a loop and never down loads. The little circle at top just keeps going round in circles .
Then when I try to click on the screen again the screen goes opaque and I get the same message re " Mozilla Firefox not responding" - and it is minutes before I can get back in to close down screen.
I have downloaded Fire fox version 4 and this is still happening.See:
* http://kb.mozillazine.org/Error_loading_websites -
How to get the object class field value in CDHDR table for vendor
hi
how to get the object class field value in CDHDR table for vendorTry KRED/KRED_N as object class in CDHDR for Vendor.
-
Get information for classes from call stack in abap (like java reflection)
Hi,
is there any possibilty to get following information:
I want to program a logging tool. You can create a logging object and use some methods like
xxxxx->add_msg(msg) to put logging information to the logging object.
but i also want to find out, from which class/object/runtime environment this msg comes.
example:
class CL_ABC uses the logging tool and does following call:
lo_logger = CL_logger->get_logger().
lo_logger->add_msg( 'test the code' ).
now the method ->add_msg() in logger object is called. inside this method, i want to have the information, from which class/object the ->add_msg() method is called. after the call, the logging object must have this information like:
CALL_CLASS: CL_ABC
CALL_LINE: 83
MSG: test the code
any ideas?You can use the SYSTEM_CALLSTACK function module.
Read this thread, Uwe has given details on both getting the calling class and method: Re: How to determine current method / interface method that is running?
Most probably this solves your needs.
Regards -
I haven't done anything to my Macbook (I don't think) but out of the blue when adding entries to my calendar, I now get the message "the server responded with an error". Consequently it will not sync with the Cloud. I have an iMac which DOES sync with both iPad and the iPhone.
Anyone any idea?
ALanSorry, no help there. Ical does not stay open long enough to do anything with. All it does is crash and apologise and say it will notify Apple.
Guess I will just delete it altogether and use google calendar. -
How to get the root class in call heirarchy
Hi,
Is anybody have some idea regarding the getting name of a class whose, main method was called at the time of begining. In other words if we say, how can we get the invoker class of a java program with multiple level of inheritence.
RegardsDocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder db=factory.newDocumentBuilder();
Document doc=db.parse(new File(ur xml file"));
Element root=doc.getDocumentElement();
System.out.println("root "+root.getNodeName()); -
How to get the current class name in static method?
Hi,
I'd like to get the current class name in a static method. This class is intended to be extended. So I would expect that the subclass need not to override this method and at the runtime, the method can get the subclass name.
getClass() doesn't work, because it is not a static method.
I would suggest Java to make getClass() static. It makes sense.
But in the mean time, does anybody give an idea to work around it?
Thank you,
BillWhy not create an instance in a static method and use getClass() of the instance?
public class Test {
public static Class getClassName() {
return new Test().getClass(); -
Getting list of classes?
Hello all, I was just wondering if there is any way to get a list of all the known classes in a certain package? I know I can get a list of the packages themselves, but not sure about how to go about getting the actual classes.
Thanks for the help!
-NickIf you only want to get a classes list from a jar package,read the api specof java.uitil.jar.
java.uitil.jar privides classes for reading and writing the jar file.
So I think it can satisify your requirement. -
Safari has become unusable—it freezes, links are unclickable, then I get "Web pages are not responding..."
Safari has been my favorite browser for a long time. Nothing against the others but I have found it faster and better. Now I can really no longer use it. This has been going on and getting worse for atr least few weeks. Anyone know why?From the Safari menu bar, select
Safari ▹ Preferences ▹ Extensions
If any extensions are installed, disable them and test. -
I need some help ASAP!!! I have charges from itunes via in-app purchases that are almost all same amounts but different times. i can not get anyone from apple to respond to me. After i did the whole quick lane via online it said chat later.
On emal that contains bill i even did the report a problem and nothing would happen. I have never had a problem and just want to resolve asap as now its declining my credit card..someone help me PLEASE!!!Follow these exact instructions:
1) http://www.apple.com/support/itunes/contact/
2) Get iTunes support via Express Lane
3) iTunes store
4) Purchases, billing & redemption
5) iTunes Store account billing
6) Fill out info about your device (the one you're accessing iTunes from)
7) Continue
8) Sign in with Apple ID
9) You see "Contact Options." DO NOT choose chat later, but rather select Email. -
Ical problem already 3 weeks after the update, get the message every time username or password is incorrect as I do with this password and username in mobileme bowl. now get the message
The server responded with \ 'HTTP/1.1 409 Conflict \'.
can someone help meIcal problem already 3 weeks after the update, get the message every time username or password is incorrect as I do with this password and username in mobileme bowl. now get the message
The server responded with \ 'HTTP/1.1 409 Conflict \'.
can someone help me -
How to get SDKODBC Wrapper class for indesign cs3
Hi,
I have to implement the mysql database with my indesign plugin. I didn't have a SDKODBC Wrapper class. Can any one say how to get SDKODBC Wrapper class from adobe.
Regards,
saravanan.I doubt if change documents are generated for SE78 transaction.
For list of change documents defined, please check table: TCDOB.
Hope this helps.
Kind Regards
Eswar
Maybe you are looking for
-
Mail Adapter Configuration in XI 3.0
Hi all, i tried to set up a process using the mail adapter. Unfortunately it doesn't work. Has anyone succeeded in setting up a process with the mail adapter using POP3 and SMTP?
-
I downloaded Photoshop CS6 from the internet today onto my MacBook Pro and it is now on my desktop but when I double click on the icon, it only gives me a blank page and no options to complete the installation or to put in my serial number. Please he
-
How to close TCP port in LV 4.1?
I've used the "TCP Listen" VI and the combination of "TCP Create Listener" & "TCP Wait on Listener" to accept a socket connection. That works fine, but I do not want the app to listen for any more requests once it has a connection. I would expect "TC
-
Hi All! Scenario: O 8.1.7.4 propagation to 10g. Error from prop. schedule: ORA-02068: following severe error from DBL_BM ORA-03114: not connected to ORACLE ORA-02068: following severe error from DBL_BM ORA-03113: end-of-file on communication channel
-
Hi All, Is there any routine in Standard SAP which will put value of Latest GR price Rgds, VSP