var J:Number = 0;
var up:Boolean = false;
function checkUPKey(event:KeyboardEvent) {
if (event.keyCode == 38) {
up = true;
}
}
function checkKeyUP (event:KeyboardEvent){
if (event.keyCode == 38) {
event.keyCode = 0;
up = false;
}
}
function huge_fucking_function(event):void {
if (up) {
J +=1;
trace(J);
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkUPKey);
stage.addEventListener(KeyboardEvent.KEY_UP, checkKeyUP);
stage.addEventListener(Event.ENTER_FRAME, huge_fucking_function);
this is my code in AS3
Copy paste it into your flash and notice how it traces as long as you keep the UP key pressed, i don't want that, i want it to add and trace with every key press
bear in mind that the huge_fucking_function has all the other movement codes in it.