flash as2 文本字段 - 输入关键问题
我的 Flash 文件中有一个搜索框,当在文本字段内按下 Enter 键时,我试图让它执行 getURL(),但什么也没有发生。有人可以让我知道问题是什么吗?
this.createTextField("dynamic_txt", 1, 115, 9, 138, 22);
dynamic_txt.type = "input";
dynamic_txt.multiline = false;
dynamic_txt.wordWrap = false;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.size = 12;
my_fmt.color = 0x000000;
my_fmt.underline = false;
dynamic_txt.text = "This is my first test field object text.";
dynamic_txt.setTextFormat(my_fmt);
button_search.onRelease=function(){
trace("Search Button");
getURL("http://www.website.com/?s="+dynamic_txt.text, "_blank");
}
dynamic_txt.onKeyDown = function() {
trace("Pressed Enter");
if (Key.isDown(Key.ENTER)) {
trace("You Pressed Enter");
getURL("http://www.website.com/?s="+dynamic_txt.text, "_blank");
}
};
I have a search box in my flash file and I'm trying to have it execute a getURL() when the enter key is pressed inside the text field, but nothing is happening. Can someone let me know what the issue is?
this.createTextField("dynamic_txt", 1, 115, 9, 138, 22);
dynamic_txt.type = "input";
dynamic_txt.multiline = false;
dynamic_txt.wordWrap = false;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.size = 12;
my_fmt.color = 0x000000;
my_fmt.underline = false;
dynamic_txt.text = "This is my first test field object text.";
dynamic_txt.setTextFormat(my_fmt);
button_search.onRelease=function(){
trace("Search Button");
getURL("http://www.website.com/?s="+dynamic_txt.text, "_blank");
}
dynamic_txt.onKeyDown = function() {
trace("Pressed Enter");
if (Key.isDown(Key.ENTER)) {
trace("You Pressed Enter");
getURL("http://www.website.com/?s="+dynamic_txt.text, "_blank");
}
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)