Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Bug(?) in a Multicore version  (Read 8598 times)
sysaux
Newbie
*
Posts: 4


View Profile Email
« on: February 17, 2009, 03:50:50 »

Hi all!

I'm new to programming in multicore PureMVC, and i had this run-time error

:
Error: multitonKey for this Notifier not yet initialized!
at org.puremvc.as3.multicore.patterns.observer::Notifier/get facade()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\patterns\observer\Notifier.as:89]
at org.puremvc.as3.multicore.patterns.observer::Notifier/sendNotification()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\patterns\observer\Notifier.as:59]
at kz.kazinfosystems.tdb.controller::AppStartupCommand/initializeMacroCommand()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\kz\kazinfosystems\tdb\controller\AppStartupCommand.as:11]
at org.puremvc.as3.multicore.patterns.command::MacroCommand()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\patterns\command\MacroCommand.as:58]
at kz.kazinfosystems.tdb.controller::AppStartupCommand()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\kz\kazinfosystems\tdb\controller\AppStartupCommand.as:9]
at org.puremvc.as3.multicore.core::Controller/executeCommand()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\core\Controller.as:115]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at org.puremvc.as3.multicore.patterns.observer::Observer/notifyObserver()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\patterns\observer\Observer.as:100]
at org.puremvc.as3.multicore.core::View/notifyObservers()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\core\View.as:127]
at org.puremvc.as3.multicore.patterns.facade::Facade/notifyObservers()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\patterns\facade\Facade.as:294]
at org.puremvc.as3.multicore.patterns.facade::Facade/sendNotification()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\org\puremvc\as3\multicore\patterns\facade\Facade.as:277]
at kz.kazinfosystems.tdb::ApplicationFacade/startup()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\kz\kazinfosystems\tdb\ApplicationFacade.as:31]
at app/handleCreationComplete()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\app.mxml:19]
at app/___app_Application1_creationComplete()[E:\Data\Work\Projects\workspaces\flex\tdb-modular\src\app.mxml:3]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298]
at mx.core::UIComponent/set initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]

when i wrote in AppStartupCommand

:
... AppStartupCommand extends Macrocommand{
override protected function initializeMacroCommand():void{
    addSubCommand(RegisterMediatorCommand);
    sendNotification(ApplicationFacade.STARTED);
    }
}

I get error when I tried to send Notification after executing of some simpleCommands.

Where is a problem?

P.S.:Sorry for my bad English
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 18, 2009, 06:25:36 »

In MultiCore you cannot send notifications until after your command (or mediator or proxy) is constructed. The earliest you can call is initializeNotifier, but generally the best practice is to wait until onRegister is called and do any facade manipulation or sending of notifications that need to happen there.

In MultiCore, the INotifiers don't get their reference to ther facade until after they've been constructed. But its best in Standard and MultiCore to defer any notes or facade calls til onRegister. So that the actor doesn't start any 'conversations' it isn't prepared to participate in because it isn't registered yet.

-=Cliff>
Logged
sysaux
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: February 18, 2009, 08:55:55 »

I understood this by experiment))) and now i write my "sendNotofocation..." code on
actor's "onRegister" method.

But anyway - thanks, Cliff! I had some doubt in my solution...
Logged
Pages: [1]
Print