如题:
偶尔会出现如下错误,在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~
本文介绍了一种常见的Flash应用开发中出现的TypeError错误,详细解析了错误产生的原因及如何通过实现IFocusManagerContainer接口来修复该问题。
722

被折叠的 条评论
为什么被折叠?



