错误信息如下:
TypeError: Error #1009: 无法访问空对象引用的属性或方法。
at Function/platform.module:ModulesManager/addModule/platform.module:showModule()[D:\Design\eclipse_new\workspace\PlatformLib\src\platform\module\ModulesManager.as:227]
at Function/platform.module:ModulesManager/addModule/platform.module:handleModuleLoad()[D:\Design\eclipse_new\workspace\PlatformLib\src\platform\module\ModulesManager.as:216]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at ModuleInfoProxy/moduleEventHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\modules\ModuleManager.as:1149]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at ModuleInfo/readyHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\modules\ModuleManager.as:793]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::FlexModuleFactory/update()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\FlexModuleFactory.as:535]
at mx.core::FlexModuleFactory/docFrameHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\FlexModuleFactory.as:681]
at mx.core::FlexModuleFactory/docFrameListener()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\FlexModuleFactory.as:131]
解决方法如下:
1.在Index.mxml声明LineChart。
public var lineChart:LineChart;
2.在使用LineChar的页面添加代码。
override public function get moduleFactory():IFlexModuleFactory {
return FlexGlobals.topLevelApplication.moduleFactory;
}
3.Flex编译器添加参数。
-locale zh_CN -keep-all-type-selectors=true