"FlexGlobals.topLevelApplication.addEventListener" cannot pick up keyboard input on PopUp

Suppose I have an application and a global event listener. Should key events fired in PopUp be caught by this listener? Or maybe pop-ups don't fit into this hierarchy? The test code is simplified here so you can understand what I'm talking about:

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
<mx:Script><![CDATA[
private function init():void {
            FlexGlobals.topLevelApplication.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDownHandler);
        }

        private function myKeyDownHandler(event:KeyboardEvent):void {
            Alert.show("It works!");
        }

        private function makeNewPopup():void {
            var win:PopupWindow = new PopupWindow(this, new TestingForm(), true, "Popup", false);
            win.showPopup();
        }
]]></mx:Script>
<mx:VBox>
        <mx:TextInput/>
        <mx:Button label="MakePopup" click="makeNewPopup()"/>
    </mx:VBox>
</mx:Canvas>

Good that we have. After starting the application, put the input focus in TextInput and press any letter. A warning will be triggered. Now click MakePopup and do the same in it TextInput .. no feedback from it.

Any thoughts on this?

+3
source share
1 answer

- SystemManager. , FlexGlobals.topLevelApplication.systemManager stage.

+5

Source: https://habr.com/ru/post/1795748/


All Articles