Adjust focus on popup text

I am trying to open a popup with immediately edited TextInput. This means that the user should be able to enter inside TextInput after the popup is displayed.

The problem is that I cannot focus on textInput. It happens that when you press the key for the first time, no text is entered, only after pressing the second key, the component gain focus and the user can print. For example, entering a β€œtest” after a pop-up pop-up window displays β€œest” ...

For some reason, the component only gets focus when the user explicitly clicks on it or something. Software focus adjustment does not work.

Any ideas / suggestions?

the code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns="mog.miss.component.*" xmlns:mx="http://www.adobe.com/2006/mxml" >

<mx:Script>
    <![CDATA[
        import mx.managers.IFocusManagerComponent;

        private function focus():void{
            focusManager.setFocus(commentTextInput as IFocusManagerComponent);
            commentTextInput.setSelection(commentTextInput.text.length,commentTextInput.text.length);
        }

    ]]>
</mx:Script>
<mx:TextInput id="commentTextInput" creationComplete="{focus()}" />

</mx:Panel>
+5
4

, F10. F10 ... , , - . . - F10.

+2

, . , createComplete :

private function onCreationComplete():void 
{
    focusManager.setFocus(this.mytextInput as IFocusManagerComponent);
}

PS: "" mxml, .

0

. creationComplete :

private function onCreationComplete():void
{
  callLater(this.commentTextInput.setFocus);
}
0

in my case, I just implemented IFocusManagerContainer in my custom component, and everything worked fine

private var _defaultButton: IFlexDisplayObject = / default component /;

    public function get defaultButton():IFlexDisplayObject{
        return _defaultButton;
    }
    public function set defaultButton(value:IFlexDisplayObject):void{
        _defaultButton = value;
        ContainerGlobals.focusedContainer = null;
    }
0
source

All Articles