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>