輸入文本光標的顯示問題?
时间:2011-06-24
来源:互联网
复制内容到剪贴板
this.createTextField ("username_txt",this.getNextHighestDepth (),100,100,100,22);
this.createTextField ("password_txt",this.getNextHighestDepth (),100,130,100,22);
this.createEmptyMovieClip ("submit_mc",this.getNextHighestDepth ());
submit_mc.createTextField ("submit_txt",this.getNextHighestDepth (),100,160,100,22);
submit_mc.submit_txt.autoSize = "center";
submit_mc.submit_txt.text = "Submit";
submit_mc.submit_txt.border = true;
submit_mc.onRelease = checkForm;
username_txt.border = true;
password_txt.border = true;
username_txt.type = "input";
password_txt.type = "input";
password_txt.password = true;
trace(Selection.setFocus ("username_txt"));
//trace false
//
function checkForm ():Boolean
{
if (username_txt.text.length == 0)
{
status_txt.text = "fill in username";
trace(Selection.setFocus ("username_txt"));
//trace true;
return false;
}
if (password_txt.text.length == 0)
{
status_txt.text = "fill in password";
Selection.setFocus ("password_txt");
return false;
}
status_txt.text = "success!";
Selection.setFocus (null);
return true;
}
爲什麽一進來的時候,是false呢?點擊按鈕后就是true。代码:
this.createTextField ("status_txt",this.getNextHighestDepth (),100,70,100,22);this.createTextField ("username_txt",this.getNextHighestDepth (),100,100,100,22);
this.createTextField ("password_txt",this.getNextHighestDepth (),100,130,100,22);
this.createEmptyMovieClip ("submit_mc",this.getNextHighestDepth ());
submit_mc.createTextField ("submit_txt",this.getNextHighestDepth (),100,160,100,22);
submit_mc.submit_txt.autoSize = "center";
submit_mc.submit_txt.text = "Submit";
submit_mc.submit_txt.border = true;
submit_mc.onRelease = checkForm;
username_txt.border = true;
password_txt.border = true;
username_txt.type = "input";
password_txt.type = "input";
password_txt.password = true;
trace(Selection.setFocus ("username_txt"));
//trace false
//
function checkForm ():Boolean
{
if (username_txt.text.length == 0)
{
status_txt.text = "fill in username";
trace(Selection.setFocus ("username_txt"));
//trace true;
return false;
}
if (password_txt.text.length == 0)
{
status_txt.text = "fill in password";
Selection.setFocus ("password_txt");
return false;
}
status_txt.text = "success!";
Selection.setFocus (null);
return true;
}
我想一進來的時候就有光標的顯示了。有什麽好的方法沒有?
作者: QWEASZ 发布时间: 2011-06-24
做假个光标
作者: flash023 发布时间: 2011-06-24
呵呵,最坏的打算也是这样想的,只是想着用程序看能否实现了。
作者: QWEASZ 发布时间: 2011-06-24
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28