Groups | Blog | Home
all groups > flash (macromedia) > november 2006 >

flash (macromedia) : keypress command


Goat-King
11/16/2006 3:37:04 PM
That's not flash, thats your computer.
You'll have to change your keyboard settings for rapid key repeat.
I assume you're using Windows so just go to *Start>Control
Panel>Printers and Other Hardware>Keyboard*, if you're in category view
or *Start>Control Panel>Keyboard* and change the repeat delay to as low
as it'll go, and the repeat rate as fast.
As far as I know if you do the Action Script that way it uses the
keyboard settings so when you press and hold it says "okay, you pressed
it once", then waits based on the delay you set, and then says, "okay,
repeat key press", there might be another way to get it moving
immediately once you just press it once, but you'd probably have to
create a function and have it repeat movement in some direction after
just pressing the key once, and do the same for lifting the key up.
But I don't know, I don't want to think right now ^_^
Good luck.
Oh, what are using this for?
~Casey
Balloony2
11/16/2006 11:13:11 PM
When using a keypress command , for example to move an item left .if you hold
the key down the item will move once then momentarily pause then start moving
again and continue moving till you let go. Is there a way to remove the
momentary pause?
this is the code I use:

on (keyPress "<Left>") {
this._x -= 15

}

Thanks in advance.
urami_
11/17/2006 12:00:00 AM


[quoted text, click to view]

no, there is no way.



--
Best Regards

Urami


--


<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
Jose Guevara
11/17/2006 9:27:12 AM
_global.keyIsDown = false ;

var myListener:Object = new Object();
myListener.onKeyDown = function () { keyIsDown = true ; }
myListener.onKeyUp = function () { keyIsDown = false ; }
Key.addListener(myListener);

onEnterFrame = function () {
if ( keyIsDown ) {
switch ( Key.getCode() ) {
case Key.LEFT:
_root.move_mc._x -= 5;
break;
case Key.RIGHT:
_root.move_mc._x += 5;
break;
case Key.UP:
_root.move_mc._y -= 5;
break;
case Key.DOWN:
_root.move_mc._y += 5;
break;
default:
break;
}
}
}



[quoted text, click to view]

AddThis Social Bookmark Button