浏览器加载swf后,Flex组件自动获取输入焦点。 1.在flex中设置焦点 as3 代码
- <mx:Application
- xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="absolute"
- creationComplete="initApp()">
-
- <mx:Script>
- [CDATA[
-
- public function initApp():void {
- application.focusManager.setFocus(nameInput);
- }
- ]]
- </mx:Script>
-
- <mx:Label x="10" y="10" text="name"/>
- <mx:Label x="10" y="36" text="password"/>
- <mx:TextInput x="74" y="32" id="passwordInput"/>
- <mx:TextInput x="74" y="8" id="nameInput"/>
- <mx:Button x="178" y="62" label="Login"/>
-
- </mx:Application>