Im trying to notify user in login screen if CapsLock is on. In creationComplete Keyboard.capslock returns always false. Is there any workaround for this? Here is what i try:
protected function applicat开发者_StackOverflow中文版ion1_creationCompleteHandler(event:FlexEvent):void
{
callLater(setListener);
}
private function setListener():void
{
if (Keyboard.capsLock)
{
lblCapsLock.visible = true;
}
else
{
lblCapsLock.visible = false;
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, application1_keyDownHandler);
}
protected function application1_keyDownHandler(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.CAPS_LOCK)
{
if (Keyboard.capsLock)
{
lblCapsLock.visible = true;
}
else
{
lblCapsLock.visible = false;
}
}
}
There is a bug reported in Adobe Bug and Issue Management System: http://bugs.adobe.com/jira/browse/FP-2033
I wonder why it's in state Cannot Reproduce
Old topic but this may help someone... found with the wmode set to transparent the keyboard.capsLock value is always false. Or it may only be swfobject specific.
精彩评论