开发者

Flex Keyboard.capslock returns always false in creationComplete

开发者 https://www.devze.com 2023-03-20 09:45 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消