加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex TextInput获取光标

发布时间:2020-12-15 05:12:31 所属栏目:百科 来源:网络整理
导读:?????????? Flex中有些页面,如果不控制光标定位,用起来不那么方便。今天早上,我也上网查了查如何去定位,总结一下: ? ????????? 首先, mx:Application? ??? ? ? xmlns:mx="http://www.adobe.com/2006/mxml"? ??? ? ? layout="absolute"? ??? ? ? creati

?????????? Flex中有些页面,如果不控制光标定位,用起来不那么方便。今天早上,我也上网查了查如何去定位,总结一下:

?

????????? 首先,

<mx:Application? ???
? ? xmlns:mx="http://www.adobe.com/2006/mxml"? ???
? ? layout="absolute"? ???
? ? creationComplete="initApp()">? ?
? ?? ???
? ?? ? ? ? <mx:Script>
? ?? ? ? ? ? ? ? ? <![CDATA[
? ?? ? ? ? ? ? ? ? ? ? ? ? public function initApp():void
? ?? ?? ?? ?{
????????????????? this.focusManager.setFocus(userName);
???????????????? userName.focusManager.activate();

????????????}
? ?? ? ? ? ? ? ? ? ]]>
? ?? ? ? ? </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>
其实这样改好之后,只运行swf文件,是可以看到效果的了,但是如何要用网页的形式去访问,则看不到效果!这时需要找到这个Application对应的.html文件

上面这个的文件是index.swf,在同目录下,可以找到一个index.html文件。

这时,在index.html文件里面添加

document.getElementById("index").focus();?? 这样一句js。

保存,运行!掂!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读