all groups > flash actionscript > april 2006 >
You're in the

flash actionscript

group:

How can I make a Key.isDown(keyname) make it only check a certain amount every second?


How can I make a Key.isDown(keyname) make it only check a certain amount every second? WeirdGuy
4/11/2006 8:36:47 PM
flash actionscript: if (Key.isDown(keyD)) {
this._x+=moveSpeed;


Lets say I wanted this to not check continually like it does but instead check
for it like 6 times a second (or some other random number) and do what I tell
it to only once when it's checked.

So instead of it constantly telling it to do that thing if it's down, it does
that effect a certain amount of times in a given time period.

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
thekey = Key.getCode();
trace(thekey);
//LEFT
if (thekey ==65) {
xdir -= 1;
}

This makes my moveclip go left. However I might want to to check not
continually but instead every now and then in a specified time period.

Re: How can I make a Key.isDown(keyname) make it only check a certain amount every second? shyaway
4/11/2006 10:24:39 PM
Re: How can I make a Key.isDown(keyname) make it only check a certain amount every second? WeirdGuy
4/11/2006 10:26:03 PM
AddThis Social Bookmark Button