Flash ActionScript Key.isDown Command
March 1, 2005 12:13 PM   RSS feed for this thread 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 comments total)
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


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 10 fine arts students from Ore...   |   I want to spend three to six m... Newer »

You are not logged in, either login or create an account to post comments



Related Questions
Actionscript community site? March 20, 2008
Does anyone know of a book that covers Flash CS3... September 3, 2007
Actionscript development on OS X that doesn't suck? May 14, 2007
ActionScript book for an experienced programmer? March 30, 2007
Actionscript Problem on how to flip a movie clip November 28, 2005