关于在Module中的getStyle报错TypeError: Error #1009: Cannot access a property or method

我尚未搞清楚Flex的Module机制究竟在干什么...

 

 

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.core::UIComponent/getStyle()[E:\dev\hero_private\frameworks\projec ts\framework\src\mx\core\UIComponent.as:11055]
at mx.styles::StyleProtoChain$/setStyle()[E:\dev\hero_private\frameworks \projects\framework\src\mx\styles\StyleProtoChain.as:688]
at mx.core::UIComponent/setStyle()[E:\dev\hero_private\frameworks\projec ts\framework\src\mx\core\UIComponent.as:11081]
at spark.skins.spark::BorderContainerSkin/updateDisplayList()[E:\dev\her o_private\frameworks\projects\spark\src\spark\skins\spark\BorderContai nerSkin.as:158]
at mx.core::UIComponent/validateDisplayList()[E:\dev\hero_private\framew orks\projects\framework\src\mx\core\UIComponent.as:8951]
at spark.components::Group/validateDisplayList()[E:\dev\hero_private\fra meworks\projects\spark\src\spark\components\Group.as:1027]
at mx.managers::LayoutManager/validateDisplayList()[E:\dev\hero_private\ frameworks\projects\framework\src\mx\managers\LayoutManager.as:736]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\hero_privat e\frameworks\projects\framework\src\mx\managers\LayoutManager.as:801]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\her o_private\frameworks\projects\framework\src\mx\managers\LayoutManager. as:1180]

 

以下是adobe论坛的原话

http://forums.adobe.com/thread/831894 写道

In your main application do not reference the module's class name. It looks like you are referencing a module "sample" on this line:

private var mod:sample;


If you need to call methods on the module use an interface to provide the API. Referencing the module's class name causes all the classes in the module to be linked into the main application, defeating the purpose of modules.

 
总之你不能在你的被优化的application当中去引用你自定义的Module模块,任何的引用都将会导致在Module里面的所有类会被链接到application当中。你只定义一个通用的api来访为这些模块。这本来就是模块开发的原则。看来我想省些功夫都不行啊。

 

 

你可能感兴趣的:(关于在Module中的getStyle报错TypeError: Error #1009: Cannot access a property or method)