multitonKey for this Notifier not yet initialized!
官方解释是:
As
noted in the release notes for MultiCore, you cannot access the facade
from within the constructor of a Notifier subclass. The first chance you
get to access the Facade is in initializeNotifier. But you could
instead wait until onRegister. If you wait until onRegister, you don't
have to call super at all.
And
although this represents a slight departure from the Standard version
practices, it actually sheds light on the fact that calling the facade
inside the constructor of a Notifier instance is not really the best
practice anyway. Of course onRegister has only just appeared in 2.0 and
so the fact that it is the more appropriate place for facade access is
just now becoming clear.
Why
is onRegister the better place? Because interaction with the Facade
should only happen when a Mediator or Proxy is registered, and therefore
accessible by other actors via the Facade. For instance a Mediator's
interaction with the Facade could lead to a Notification that the
Mediator needs to hear. But if it is not yet registered, it could not be
notified. Or if a Proxy interacts with the Facade, it could result in
another actor trying to retrieve that Proxy, and if it is not yet
registered, it cannot be retrieved.
Make sense?
也就是说,在所有的订阅者的构造器上,不要访问facade。访问了也白搭。
官方建议在onRegister方法上,来访问facade。
例如:
override public function onRegister():void
{
var avatarPanel:AvatarPanel = new AvatarPanel();
facade.registerMediator(new AvatarMediator(avatarPanel));
controlBarPanel.avatarPanel = avatarPanel;
}
还有
override public function onRegister():void
{
sendNotification(ApplicationFasade.DATALOADED);
}
出现这个问题把send的代码写在onRegister()函数里即可
分享到:
相关推荐
多核版本的PureMVC,如“pureMVC_AS3_MultiCore”,是为了应对更复杂的项目需求,特别是在多线程或分布式环境中的应用。这个版本的PureMVC允许开发者将应用程序分解成多个独立的子系统,每个子系统都可以运行在不同...
标题中的“puremvc multicore”指的是PureMVC多核架构,这是一个广泛应用的开源框架,尤其在Adobe Flex开发中。PureMVC是Model-View-Controller(模型-视图-控制器)设计模式的一种实现,旨在提高应用程序的组织结构...
PureMVC AS3 MultiCore 是一个开源框架,用于构建ActionScript 3.0应用程序。它遵循Model-View-Controller(MVC)设计模式,并提供了一种结构化的方法来组织和管理应用程序的组件,使得代码更加模块化、可维护性和可...
在本篇文章中,我们将深入探讨"puremvc-js-multicore-framework-master"这一项目,它代表了PureMVC在JavaScript中的多核实现。 1. **PureMVC简介** PureMVC是基于观察者模式的框架,它将应用程序分为三个主要部分...
压缩包子文件“puremvc-1.0”可能是PureMVC JavaScript Native MultiCore框架的一个版本号为1.0的发行版。这个文件可能包含框架的核心类库、示例代码、文档和其他必要的资源,帮助开发者理解和使用PureMVC来构建...
标题 "PureMVC 中文版" 指的是 PureMVC 框架的一个中文版本,这是一款广泛应用的开源框架,特别设计用于构建富互联网应用程序(RIA),尤其是基于Adobe Flex和ActionScript 3的项目。PureMVC 提供了一种模块化、结构...
PureMVC则是一个经典的多层应用程序框架,最初设计用于ActionScript环境,但现在已经有了多种语言版本,包括JavaScript,这使得它在Cocos Creator的JavaScript项目中也能应用。 在Cocos Creator中使用PureMVC,主要...
标题中的“可以运行的PureMVC的登陆实例”是指一个基于PureMVC框架的登录功能实现,这个实例已经经过验证可以在FlexBuilder3环境下正常运行。PureMVC是一种经典的多层应用架构模式,它为ActionScript、JavaScript、...
这个是一个根据AS3(ActionScript 3) pureMVC而转换过来的lua pureMVC。所有的接口完全跟AS3版本一致。 若是想使用,可以直接查看网上的pureMVC 文档,我并未对任何一个函数改名或者更换参数位置。 注意,这个PureMVC...
6. **Multicore**:在多线程版的PureMVC中,`Multicore`扩展了框架以支持多线程环境。它引入了一个`Core`实体,每个线程有一个独立的Core,负责管理其线程内的模型、视图和控制器。线程间的通信通过`Core`间的协调...
`org.puremvc.java.multicore.patterns.command`和`org.puremvc.java.multicore.patterns.proxy`则包含了Command和Proxy的实现。而`org.puremvc.java.multicore.patterns.facade`中的`Facade`类作为整个框架的入口点...
如你下载后的存放的目录是D组:/下载,解压后将创建一个名为PureMVC_AS3_2_0_4的文件夹...注:当然我们也可以把puremvc的的源代码直接复制到我们的项目中使用,那样就无需添加swc了,两者只能存在一个,否则会报错。
标题中的"PureMVC_CSharp.zip_csharp_pureMVC_pureMVC C_pureMVC C#"表明这是一个关于C#语言实现的PureMVC框架的压缩包。"疯铮铮"可能是作者或分享者的名字,也可能是对项目热情的表达。 描述中提到的"PureMVC_...
PureMVC的核心组件包括:MacroCommand、Command、Mediator、Proxy、Notifier和Singleton,这些组件协同工作以实现业务逻辑与视图的解耦。 标签“puremvc”进一步确认了这个压缩包内容是关于PureMVC框架的学习资料。...
纯MVC(PureMVC)是一个轻量级的框架,主要设计用于构建应用程序的模型-视图-控制器架构。这个框架最初是为ActionScript 3编程语言开发的,但现在已经被移植到许多其他编程语言,包括Java、C#、Python、JavaScript等...
PureMVC是一个开源的、轻量级的框架,主要用于构建多层应用程序,尤其适用于富互联网应用(RIA)的开发。这个框架是基于Model-View-Controller(MVC)设计模式的,它提供了一种结构化的解决方案,使得开发者可以更...
**纯MVC(PureMVC)AS3版详解** PureMVC是一款轻量级的框架,主要用于实现Model-View-Controller(MVC)设计模式。它最初由Dan Varga创建,旨在提供一种跨平台的解决方案,使开发人员能够更有效地组织和管理应用...
**PureMVC框架详解** PureMVC是一种轻量级、模型-视图-控制器(MVC)框架,最初是为ActionScript开发的,后来被移植到多种编程语言中,包括C++。它提供了一种组织代码结构的方式,使得开发者可以更高效地构建可维护...
PureMVC是面向对象的多层应用程序框架,它提供了一种模式来组织代码,使开发更加规范和高效。本篇文章将深入探讨Unity中如何使用PureMVC框架,以及它如何帮助实现UI和逻辑的分离。 PureMVC是一个轻量级的框架,其...
《深入理解PureMVC:基于五子棋游戏的源码分析》 PureMVC是一个流行的、开源的、轻量级的、跨平台的MVC框架,它为开发人员提供了一种结构化的编程模式,用于组织和管理应用程序的业务逻辑、用户界面和数据。在这个...