关于在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来访为这些模块。这本来就是模块开发的原则。看来我想省些功夫都不行啊。

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值