Flex页面初始化设置TextInput焦点失败问题
在设置初始焦点时,如登录窗口, 焦点可以设置停在文本框中,但是就是没法输入,解决办法如下:
?
在creationComplete中:
??? ??? ??? ??? var loginWindow:LoginWindow = new LoginWindow();
??? ??? ??? ??? //loginWindow.x = (this.width/2)-loginWindow.width/2;
??? ??? ??? ??? //loginWindow.y = (this.height/2) - loginWindow.height/2;
??? ??? ??? ??? loginWindow.addEventListener(LoginWindowEvent.LOGIN,checkAccount);
??? ??? ??? ??? PopUpManager.addPopUp(loginWindow,this,true);
??? ??? ??? ??? PopUpManager.centerPopUp(loginWindow);
??? ??? ??? ??? /* loginWindow.closeButton.visible=true; */
??? ??? ??? ???
??? ??? ??? ??? focusManager.setFocus(loginWindow.txtUsername);
??? ??? ??? ??? ExternalInterface.call("document.getElementById('iaas_index').focus()");
用ExternalInterface来直接调用js,iaas_index就是swf的id.
?
可参考文章http://www.cnblogs.com/Anlycp/archive/2012/02/11/2346550.html