Hello again,

I am working on a new game with actionscript 3 and was coming up with some complications.

I am very used to actionscript 2.0 and I've been trying to force feed this new script and learn as much as possible.

Now for the question. I have a Keyboard event setup like this.

Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, guyMove);
stage.addEventListener(KeyboardEvent.KEY_UP, guyStop);

function guyMove(event:KeyboardEvent):void {
	if(event.keyCode == 39) {
	trace("right");
	}
	if(event.keyCode == 40) {
	trace("down");
	}
	if(event.keyCode == 37) {
	trace("left");
	}
	if(event.keyCode == 32) {
	trace("space");
	}

}
function guyStop(event:KeyboardEvent):void {
	if(event.keyCode == 39) {
	trace("right");
	}
	if(event.keyCode == 40) {
	trace("down");
	}
	if(event.keyCode == 37) {
	trace("left");
	}
	if(event.keyCode == 32) {
	trace("space");
	}

}
It actually took me a little while to get that working in some fashion. But it wasn't acting the way I wanted. When I press and hold a key, it repeats the guyMove function as if I held down a key when I was typing. It would run once, and moments later, run constantly.

I was kind of looking to get a toggle effect going. So it would trace once when I press, and once when I release. Or even simpler if I could combine into one function and actually trace the press and release without the repeating press trace if I hold the key down.

In as2.0 I would usually use an
Code:
onEnterFrame() {
if(Key.isDown(Key.LEFT) {
//do something
}
}
That would usually work fine, it would do what I want when I pressed it in an enterFrame fashion, and stop when I release the key.

ANy suggestions?

Thanks
~Bill L.