CapsLk key active

how do i know a key is active in haxe? wanted to know when CapsLk is on


return “null”

Possibly it might not work on all targets.

Something like:


import openfl.display.Sprite;
import openfl.display.Stage;
import openfl.Lib;
import openfl.ui.Keyboard;

class Main extends Sprite

	public function new()
		stage.addEventListener(KeyboardEvent.KEY_DOWN, pressed);

	private function pressed(e:KeyboardEvent):Void

works for flash but not html5. What platform are you targeting?

It appears that Keyboard.capsLock is not currently implemented at all in OpenFL. It will only work when targeting Flash/AIR at this time.

Too bad the computer camera doesn’t usually point at the keyboard, LOL.

you can try to detect shift key, maybe it will work for caps lock as well

private function pressed(event:KeyboardEvent):Void
	isShiftKeyDown = event.shiftKey;

in lime we have lime/KeyModifier.hx at develop · openfl/lime · GitHub
and capslock is already there, but seems like it’s not using in openfl events
I think you can access it somehow, or implement patch for lime