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: Starting from Scratch.  (Read 8368 times)
Bigmama
Newbie
*
Posts: 1


View Profile Email
« on: March 20, 2008, 03:03:39 »

Hi, I don't know if any of you guys had a similar situation but here it goes.
I currently have a main panel which is the main screen on my app, and im willing to switch state onFileLoad.
Now, I have defined my custom MainPanel.mxml extending from panel and when the click Event is hit, I sendNotification(ApplicationFacade.CARGAR_PCU,SinManager);

Where should I place my state code, can I create a ErrorListState.mxml(would be my 2nd state for mainPanel), and how can i make the transition when i send the notification ?

Another Issue regarding good coding practices, is about nested CommandCalls.
I think it is not Ok to invoke a command within a command, but I have done it once in my app.
Should the good practice be, send a notification from commandA so controller can decide which command to execute, and reduce coupling between my commands ?
Thanks
Tom
Logged
trilec
Sr. Member
****
Posts: 52



View Profile WWW Email
« Reply #1 on: April 01, 2008, 04:54:15 »

Hi Bigmama
in regards to a nested command calls:
you may want to check out the MacroCommand which is registered in the  ApplicationFacade . initializeController
 
In ApplicationFacade
:
override function initializeController() : void
        {
            super();
            registerCommand(APP_STARTUP, ApplicationStartupCommand);
}

example macro command
 
:
   public class ApplicationStartupCommand extends MacroCommand
    {

        public function ApplicationStartupCommand()
        {
            return;
        }
        override function initializeMacroCommand() : void
        {
            addSubCommand(ModelCommand);
            addSubCommand(ViewCommand);
            return;
        }

hope that helps some
Curt (Trilec)
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: April 02, 2008, 07:30:46 »

You're not really coupling the Commands if you send a Notification from CommandA that triggers CommandB. You would be if you just instantiated CommandB inside CommandA, and that would be bad.

As for state, you can use Flex's states to create a single component that has multiple states and use the Mediator for that View Component to trigger the changes of state when it hears a particular Notification.

-=Cliff>
Logged
Pages: [1]
Print