Flex 3:如何模拟按下 Enter/Return 键
标题几乎说明了一切...有没有一种简单的方法可以模拟按下 Enter/Return 键?
编辑:
我已经有了这么多,但我不确定如何让它在循环中运行:
var keyCode:uint = Keyboard.ENTER;
var e:KeyboardEvent = new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, keyCode);
我需要它在以下循环中运行:
for (var i:int = 0; i < changes.length; i++)
{
if (changes[i][0] == "directorsPrep")
{
directorsPrep[changes[i][1]].phaseFillers[changes[i][2]].fillDisplayName.setFocus();
// NEED IT TO RUN RIGHT HERE!
}
}
Title pretty much says it all... is there an easy way I can simulate the enter/return key being pressed?
EDIT:
I've got this much, but i'm not sure how to make it run in a loop:
var keyCode:uint = Keyboard.ENTER;
var e:KeyboardEvent = new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, keyCode);
I need it to run in the following loop:
for (var i:int = 0; i < changes.length; i++)
{
if (changes[i][0] == "directorsPrep")
{
directorsPrep[changes[i][1]].phaseFillers[changes[i][2]].fillDisplayName.setFocus();
// NEED IT TO RUN RIGHT HERE!
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
componentThatYouWantToDispatchKeyBoardEvent
变量可以是扩展 EventDispatcher 或实现 IEventDispatcher。The
componentThatYouWantToDispatchKeyBoardEvent
variable can be any component that extends EventDispatcher or implements IEventDispatcher.