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

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Getting Started / Getting started - proxys & ModelPrepCommand on: January 26, 2011, 04:13:45
Hi,

I am building my template application and wanting 3 xml files to be loaded before my application starts to do anything related to the project it will be implemented on.

I have in my ApplicationStartupCommand.as the following:

:
        override protected function initializeMacroCommand() :void
        {
trace("ApplicationStartupCommand().initializeMacroCommand()");

// I want a sequential command process here
// 1. Model prep
// 2. Embedded assets prep
// 3. View prep

// Model prep on success will call embedded assets prep
// Embedded assets prep will call view prep
// View prep will register application mediator

            addSubCommand( ModelPrepCommand );
        }


The proxy will load a local xml file, what I need is the command to listen for notifications (success or fail).

On success: addSubCommand( EmbeddedAssetsPrepCommand );

Which will just call a singleton of a embedded assets class and then add the final subCommand ( viewPrepCommand ), which in the puremvc template registers the application mediator.


Question 1:
How should a command listen for a notification if I can't use
override public function handleNotification( note:INotification ):void  ?

Question 2:
Or should I just ignore the possibilities of failure at this stage of the puremvc and assume that the xml file will always be in existence? And just place all subCommands in the ApplicationStartupCommand?

Question 3:
If I were to have a large scale application with many many many events being listened for and reacted upon, would the ApplicationFacade still have hard coded in constants for each of these events?

Thanks

Darcey
2  Announcements and General Discussion / Getting Started / Getting started on: January 18, 2011, 07:37:27
Hi,

I have just created a hello world example and have a few questions if anyone can clarify a few things before I proceed that would be great.

Q1. I have a stage mediator registered from my ApplicationMediator, this stage mediator dispatches mouse up notifications. I am randomly placing the hello world text on x and y. Where should the random x and y be calculated? Is it best practice to place the random positioning logic for the placement of the hello world view component in the ApplicationMediator via its handleNotification function where the view component is instantiated or should this be done via a command? If it's a command how do I get the reference of the view component added to the stage for x and y placement?

Q2. Registering mediators inside mediators is this correct? or should they all be registered in a centralised place for better management?

Q3. If mediators register and handle other mediators, should they be able to obtain references to other mediators? If yes how do we get the reference to the created mediator?

Q4. If for example I am building an application that has an empty container as a view, to which I add views to it later. Where would the logic go for adding view components to a view? If this is a mediator, im guessing a command would be created for listening to added for listening to events from the mediator for handling things to do when added and when removed?

Q5. If I have a 3D Scene as a view (which is default blank), and then create separate view components which can be added to the 3D Scene view, should the 3D scene view be a view or a mediator? Im guessing mediator for calling the view component (3D scene), then same mediator to listen to events and have code in it to add 3D objects to the view component or is this a more complicated scenario of many commands, mediators and views?


For a moment there while typing this I thought I clarified things for myself, then I re-read it and now think the opposite lol...


To visualise things I created some process flow class diagrams to illustrate how I think the PureMVC is actually laid out.

So the main application would be laid out like so:


Mediators would all be like so:


and all commands like so:



This look correct?


Any info is much appreciated.

Thanks

Darcey
Pages: [1]