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: Using MacroCommand with StartupResourceProxy utility  (Read 11269 times)
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« on: June 22, 2009, 03:08:49 »

I have an example that I am following and works great with the Simple command, but I also have another example that uses MacroCommands, honestly I like how the project is layed out with the Macrocommand
         
EXTENDING MACROCOMMAND:

:
override protected function initializeMacroCommand():void
{
addSubCommand( command1 );
        addSubCommand( command1 );
        addSubCommand( command1 );
}
            
VS
            
EXTENDING SIMPLECOMMAND:

:
override public function execute( note:INotification ): void
{
40 lines of code here that with subcommands they could all be broken into their own class.....
}
                  
one thing that I can't live without is a "monitor" that keeps track of what assets are being added to the StartupResourceProxy so I am forced to put everything in one class.
            
:
private function makeAndRegisterStartupResource( proxyName:String, appResourceProxy:IStartupProxy ):StartupResourceProxy
{

var r:StartupResourceProxy = new StartupResourceProxy( proxyName, appResourceProxy );
 facade.registerProxy( r );
_monitor.addResource( r );
return r;
}
         
My idea of distributing everything in subcommands is creating another Proxy that would keep track of the resources being added and provide feedback but this seems to be over work, is that the correct way to handle this issue?
            
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #1 on: June 23, 2009, 02:25:48 »

Does it help that you can, at any time, use the getResourceList() method of StartupMonitorProxy to get the IResourceList object that contains the StartupResourceProxy objects, and getResources() on that returns an array of the StartupResourceProxy objects?
----Philip
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #2 on: June 23, 2009, 06:01:22 »

I've used the SM with macro commands before, it works almost exactly the same (except you need to grab an instance of the SM in each command.

Where are you having trouble? I usually have my first macro command set-up the initial SM and then each command add what it needs to it. Then the last macro starts the loading process.
Logged
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« Reply #3 on: June 23, 2009, 12:03:55 »

Does it help that you can, at any time, use the getResourceList() method of StartupMonitorProxy to get the IResourceList object that contains the StartupResourceProxy objects, and getResources() on that returns an array of the StartupResourceProxy objects?
----Philip

it does help! I didn't know you could do that. I need to take another look at the class to see how I can push elements that are being added through the "AddSubCommand" method.
Logged
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« Reply #4 on: June 23, 2009, 12:05:48 »

I've used the SM with macro commands before, it works almost exactly the same (except you need to grab an instance of the SM in each command.

Where are you having trouble? I usually have my first macro command set-up the initial SM and then each command add what it needs to it. Then the last macro starts the loading process.

Thanks for your suggestion as well. I think this might answer my issue. My problem was that I didn't know how to keep track of my macrocommands at the same time as setting up the elements with the SM.

Thanks again.... I will let you all know how it goes
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #5 on: June 24, 2009, 02:53:08 »

I need to take another look at the class to see how I can push elements that are being added through the "AddSubCommand" method.
Just to be clear, in my post above that refers to getResources and the array of StartupResourceProxy objects, I intend this as a read-only activity; each new resource must still be added using one of the addResource methods of StartupMonitorProxy.
----Philip
Logged
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« Reply #6 on: June 24, 2009, 07:55:53 »

Thanks for the clarification.

I have run into another issue and this might have to do with understanding the SM, for what I understood originally setting the different states on the application would help us to stay within a specific state.  Using the door example you cant go from LOCKED to OPENED you just go LOCKED->CLOSED->OPENED, so if I start my application in the LOCKED state and then i send a "OPENED" notification, I am able to see that this specific notification has been sent without any errors. Shouldn't I be able to get an error that this kind of event can't happen? Or is that a logic that I must write within my app?
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #7 on: June 24, 2009, 11:14:44 »

I might have misslead you, when I said SM I meant the StartupManager, not StateMachine.

Or are you starting a different discussion concerning the State Machine now and not the start-up Manager (damn acronyms are confusing lol).
« Last Edit: June 24, 2009, 11:16:56 by Jason MacDonald » Logged
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« Reply #8 on: June 25, 2009, 02:03:56 »

I think I have confused myself above measure! I need to start a new thread with the corresponding acronyms. I have started the same application 3 times from scratch and I still get stuck on the same spot. The only thing this time is that I have been able to understand the behaviors of all the actors in a better way. Still questions arise and for those I should start a new thread...
Logged
Pages: [1]
Print