Skip to main content
Known Participant
March 12, 2008
Question

list of keyCodes?

  • March 12, 2008
  • 6 replies
  • 2125 views
Hello. I'm new to AS3, so go easy on me. =-)

I have code that enables some very basic manipulation of some test movie clips; rotating, scaling, etc. based on keyboard inputs.

However, these keyboard events are limited to the F keys, Enter, Delete, NumPad, i.e. the standard set of non-alphanumeric keys.

How do I get the movies to respond to the user pressing 'q', for example, or 't', or really any other 'mainstream' keyboard buttons? Is there a list of keyCodes out there that can help me, or am I thinking this through at the wrong angle? Thanks for any help. =-)

-dE
This topic has been closed for replies.

6 replies

Inspiring
August 22, 2008
hi all i'm kinda stuck.. any help you can offer would help..
i've located the key code / ascii code

i'm working on a video player and i'm trying to add key code..
i can get every key but the a-z keys to work with a case / switch

i've tried every combo of keyCode and Assci but none seem to work
what am i doing wrong?

March 14, 2008
yay, I always lose the keyCode values myself!
Participant
March 12, 2008
David,

Thanks for the link. Look like I'm on the right track as I've just coded up something very similar to what's in that article.

Thanks again.

-K
Inspiring
March 12, 2008
Krylar,

> Since you're talking about keycodes...is Flash limited to two
> maximum at once or something?

No, but it's a bit tougher to detect multiple keys in AS3.

> If I press Up Arrow + Left Arrow and then try to fire (spacebar) it won't
> fire. It seems that it only accepts two keys at a time.
>
> Anyone know?

See if this helps ... it's a good article.

http://www.kirupa.com/forum/showpost.php?p=2098269&postcount=319

> (p.s. thanks for the keyboard codes and great blog, David!)

Thanks!


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."


Participant
March 12, 2008
Hiya,

Since you're talking about keycodes...is Flash limited to two maximum at once or something?

If I press Up Arrow + Left Arrow and then try to fire (spacebar) it won't fire. It seems that it only accepts two keys at a time.

Anyone know?

[EDIT]Actually, it only snags one at a time. I'm assuming I'll need to do the inspecting on my own for the other keys since this is event driven.[/EDIT]


(p.s. thanks for the keyboard codes and great blog, David!)

-K
Inspiring
March 12, 2008
Deggz,

> Is there a list of keyCodes out there that can help me, or am I
> thinking this through at the wrong angle? Thanks for any help. =-)

Nah, your angle is fine ... for some reason, I always find the list of
key codes hard to locate, too. Use the Help panel to search the phrase
"Keyboard Keys and Key Code Values," and that'll bring it up. It's listed
in the "Learning ActionScript 2.0" book of the Help docs, but the codes are
the same for AS3.


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."


DeggzAuthor
Known Participant
March 12, 2008
Thanks, Dave. I found it. I should mention I've enjoyed your webiste and gleaned from it mroe than a few solutions.

A follow-up question:

Now that I have the key Code values, how would I get the code to recognize the input? Here is what I have so far:

If I wanted to change the F4 key to say, A (keyCode 65), what is the syntax for managing that process?

Thanks again!
Damon Edwards
Inspiring
March 12, 2008
In your case statements, use the value for the key code, ie,
case 65: // means F4 was pushed