FORUMS: list search recent posts

Capturing Simultaneous keystrokes

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Capturing Simultaneous keystrokes
on Jan 22, 2007 at 8:12:45 pm


I'm having a problem trying to get flash to recognize 2 keystrokes at once.

An example is you're making a game where a character runs and shoots at the same time.

You hold down the right arrow key to move and tap the space bar to fire.

Well, so far I can't get flash to recognize that the spacebar is being pushed; it proceeds as though only the right arrow key is being pressed until it is released, then it will recognize the spacebar.

I'm using a modified sample of a key listener.

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.LEFT)) {
object_mc._x = Math.max(object_mc._x - distance, 0);



Can flash do what I'm asking it? Any ideas on how to make it happen?



Return to posts index

Re: Capturing Simultaneous keystrokes
on Jan 25, 2007 at 8:54:58 pm

I'm curious about the part with "..."

The first thing that occurs to me is if you are doing the

if (Key.isDown(Key.LEFT)) {
} else
if (Key.isDown(Key.SPACE)) {

In which case you want to remove the "else."

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved