Flex 中很幽灵的一个bug

如题:

 

偶尔会出现如下错误,在debug的时候:

 

TypeError: Error #1009: Cannot access a property or method of a null object reference

at spark.components::Scroller/focusInHandler()[....\sdks\4.5.1\frameworks\projects\spark\src\spark\components\Scroller.as:1273]

 

跟进代码中去看1273 行如下:

 

override protected function focusInHandler(event:FocusEvent):void
    {
        super.focusInHandler(event);
       
        // When we gain focus, make sure the focused element is visible
        if (viewport && ensureElementIsVisibleForSoftKeyboard)
        {
            var elt:IVisualElement = focusManager.getFocus() as IVisualElement;
            lastFocusedElement = elt;
        }
    }

 

我的项目中有四个popup,至于到底是不是popup弹出窗口引起的,还不是很清楚、、、

先按照他提供的方法fix掉了:

 

解决办法如下:

 

The problem is that your popup doesn't implement the IFocusManagerContainer interface.

Implementing IFocusManagerContainer allows the system to assign a FocusManager to the popup, and this error goes away.

 

于是我在popup弹出窗口的(也就是TitleWindow)中加了个属性:

implements="mx.managers.IFocusManagerContainer"

 

至于好没有好,还得验证过一段时间。。。O(∩_∩)O~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值