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: Handling mx:State and Mediator Creation  (Read 6815 times)
Bruce.Prentice
Newbie
*
Posts: 1


View Profile Email
« on: January 09, 2008, 03:35:24 »

First thanks for this framework.  It has been helping me a lot working on our new app here at my company.  I have one quick question.
Usually the controller will register the mediators with the framework.  In my main application.mxml I am using view states that will change depending on whether the user is logged in or not.  Only issue is that I cannot register the loggedIn viewstate because it is null at this time.  So I was wondering is it good practice for me to just wait, and then when I change states send notification to the controller to register the loggedIn mediator? 
 
This is what I was trying to do
                        override public function execute( note:INotification ) : void           
                        {
                                    facade.registerProxy(new CarrierListProxy() );
                                    facade.registerProxy(new WebTaskProxy() );
                                    facade.registerProxy( new GMCLoginProxy() );
                                   
                                    var webTaskProxy:WebTaskProxy = facade.retrieveProxy(WebTaskProxy.NAME) as WebTaskProxy
                                    webTaskProxy.findWebTasks(1,"HOME");
                                   
                                    var app:gmcps = note.getBody() as gmcps;
                                    facade.registerMediator( new ApplicationMediator(app));
                                    facade.registerMediator( new DownLoadFilesMediator(app.CustView.DLFILES))   <-- failed here because app.CustView is null (it is the logged in State)
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #1 on: January 09, 2008, 04:05:32 »

I would have a LoginCommand that registers that mediator. Since it isn't needed until that time anyway.
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
Pages: [1]
Print