flex里InputText不能输入中文

最近做项目都没做任何的更新,今天突然遇到在flex里的InputText无法进行中文输入,晚上查找了下资料,很多原因说是flashplayer的一个BUG。

在网上找到两种解决办法:

1.会出现这种情况,可能是HTML里加载的时候设置了 wmode,即<param name="wmode" value="transparent" />或者<param name="wmode" value="opaque" />  只要将 其改为 <param name="wmode" value="window" />或者直接删除就行;

 wmde即窗口模式总共有三种,Macromedia官方解释:

  • Window: Use the Window value to play a Flash Player movie in its own rectangular window on a web page. This is the default value for wmode and it works the way the classic Flash Player works. This normally provides the fastest animation performance.
  • Opaque: By using the Opaque value you can use JavaScript to move or resize movies that don’t need a transparent background. Opaque mode makes the movie hide everything behind it on the page. Additionally, opaque mode moves elements behind Flash movies (for example, with dynamic HTML) to prevent them from showing through.
  • Transparent: Transparent mode allows the background of the HTML page, or the DHTML layer underneath the Flash movie or layer, to show through all the transparent portions of the movie. This allows you to overlap the movie with other elements of the HTML page. Animation performance might be slower when you use this value.

window 模式

默认情况下的显示模式,在这种模式下flash player有自己的窗口句柄,这就意味着flash影片是存在于Windows中的一个显示实例,并且是在浏览器核心显示窗口之上的,所以flash只是貌似显示在浏览器中,但这也是flash最快最有效率的渲染模式。由于他是独立于浏览器的HTML渲染表面,这就导致默认显示方式下flash总是会遮住位置与他重合的所有DHTML层。

但是大多数苹果电脑浏览器会允许DHTML层显示在flash之上,但当flash影片播放时会出现比较诡异的现象,比如DHTML层像被flash刮掉一块一样显示异常。

Opaque 模式

这是一种无窗口模式,在这种情况下flash player没有自己的窗口句柄,这就需要浏览器需要告诉flash player在浏览器的渲染表面绘制的时间和位置。这时flash影片就不会在高于浏览器HTML渲染表面而是与其他元素一样在同一个页面上,因此你就可以使用z-index值来控制DHTML元素是遮盖flash或者被遮盖。

Transparent 模式

透明模式,在这种模式下flash player会将stage的背景色alpha值将为0并且只会绘制stage上真实可见的对象,同样你也可以使用z-index来控制flash影片的深度值,但是与Opaque模式不同的是这样做会降低flash影片的回放效果,而且在9.0.115之前的flash player版本设置wmode=”opaque”或”transparent”会导致全屏模式失效。

所以各位慎用这个模式;

(我使用的是下面方法解决这个问题的,因为在我的HTML并为发现这个语句)

2.因为并未发现以上的模式语句,所以无法解决。但在另一个博客发现了方法。

FocusEvent.FOCUS_IN调度的时候 IME.enabled = true;

这样就说明,InputText 在调度FocusEvent.FOCUS_IN IME 是关闭的。

类:flash.system.IME 对于输入法的一些输入问题是至关重要的。

比如:在玩flash游戏的时候,有时候没有关闭输入法会出现无法监听到.所以可以在监听某些按键的时候设置IME.enabled = false

posted @ 2012-07-05 22:34  点亮创想  阅读(374)  评论(0编辑  收藏  举报