Flash ActionScript Key.isDown Command
March 1, 2005 12:13 PM   Subscribe

I have some ActionScript and I need to change the keyboard controls from the arrow keys (up, down, left and right) to a, z , comma and period but nothing seems to be working... Please hope me!

The code is as follows:

onClipEvent (enterframe) {
if (Key.isDown(key.DOWN) && _y < 100) { _y=_y+1; } if (key.isdown(key.up) && _y> 10 {
_y=_y-1;
}
if (Key.isDown(key.RIGHT) && _x < 200) { _x=_x+1; } if (key.isdown(key.left) && _x> 10) {
_x=_x-1;
}

I have tried replacing the DOWN, UP, RIGHT and LEFT with the letters alone, letters in quotes and the key codes listed in the Flash help file but nothing is working. What am I missing?

Note: Flash MX with ActionScript in Expert* Mode

* How ironic is that? :)
posted by stringbean to Computers & Internet (2 answers total)
 
Best answer: I think you want: Key.isDown(85)
where 85 is to be replaced with the keycode for the key you want (unless you already tried that in which case I've no idea).
posted by juv3nal at 12:30 PM on March 1, 2005


Response by poster: Seventeen minutes!

I don't know if that is a speed record for Ask MeFi...

...but I definitely do know that you are a life saver!

Thank you so much, juv3nal.

You've made my day.

(^_^)
posted by stringbean at 12:41 PM on March 1, 2005


« Older What should 10 fine arts students do in San...   |   financing the Great American Novel Newer »
This thread is closed to new comments.