的setFocus Flex中 [英] setFocus in Flex

查看:172
本文介绍了的setFocus Flex中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的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

这篇关于的setFocus Flex中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆