的setFocus Flex中setFocus、Flex

由网友(荔莞少年。)分享简介:我用下面的code在FLEX4 MXML这工作正常。I'm Using following code in flex4 mxml That works fine.我用下面的code在FLEX4 MXML这工作正常。

I'm Using following code in flex4 mxml That works fine.

<mx:Button label="Set focus to Username"
            click="focusManager.setFocus(username);" />

如何动作脚本中使用相同的我的意思是一个应用程序的创建完整的事件,而无需使用按钮。

How to use the same in Action script I mean creation complete event of an application without using button.

这是我所登录面板的应用程序,同时页面加载   用户名字段应该专注其中具有光标。

That is I have login panel in application While page loads the username field should focused having cursor in it.

任何一个可以帮助我吗?

Can any one help me?

推荐答案

问题是,你的应用程序中TextInput获得了焦点,但在HTML页面中您的Flex应用程序没有。所以基本上你需要的唯一额外的步骤就是给Flex应用程序的焦点。只有一个方法来实现这一目标:通过JavaScript。你应该这样做的在应用程序加载。

The issue is that within your application the TextInput has focus, but within the HTML page your Flex application does not. So basically the only extra step you need is to give the Flex app focus. There's only one way to achieve this: through JavaScript. And you should do it after the application was loaded.

该球员在Farrata写就怎么做这是一个非常好的例子,所以我只是要指出,你有:的 http://flexblog.faratasystems.com/2011/12/15/setting-focus-in-flex-components

The guys at Farrata wrote a very good example on how to do this, so I'm just going to point you there: http://flexblog.faratasystems.com/2011/12/15/setting-focus-in-flex-components

阅读全文

相关推荐

最新文章