TypeError: Error #1009: Cannot access a property or method of a null object reference.
at spark.components::Scroller/focusInHandler()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Scroller.as:2139]
at flash.display::Stage/set focus()
at mx.core::UIComponent/setFocus()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:9905]
at spark.components::RichEditableText/setFocus()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\RichEditableText.as:3126]
at spark.components.supportClasses::SkinnableTextBase/setFocus()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableTextBase.as:1874]
at mx.managers::FocusManager/activateWindowHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\FocusManager.as:740]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at spark.components::WindowedApplication/nativeWindow_activateHandler()[E:\dev\4.y\frameworks\projects\airspark\src\spark\components\WindowedApplication.as:2739]
在我的 Adobe Air 程序中,每当我使用我的应用程序并在此应用程序和其他应用程序之间切换焦点时,我都会遇到上述错误。 (我试过几次,这个错误是可以重现的。)
导致此问题的原因以及如何解决?
编辑:我的程序有一个堆栈 View ,其中一个堆栈 View 有一个列表。当列表中至少有一个对象时,会出现上述错误。
最佳答案
我在我的一个项目中遇到了同样的问题,看起来是 known bug of SDK .就我而言,我只是编写了自定义 Scroller 类,其中添加了 focusManager != null 检查。有点像
package components
{
import flash.events.FocusEvent;
import spark.components.Scroller;
public class MyScroller extends Scroller
{
public function MyScroller()
{
super();
}
override protected function focusInHandler(event:FocusEvent):void
{
if(focusManager != null) {
super.focusInHandler(event);
}
}
}
}
最好的成绩,罗马
关于apache-flex - 土坯空气 : scroller throws error when changes focus between different applications,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10621624/