Hello,
I have several small questions on best-practices using PureMVC on a Flex/AS3 Application.
I am posting them on the same topic, but if you prefer next time I can create a topic for each of them.
1.
There are views that are only added to stage later, so I can't register their mediator on the StartupCommand. In this case, where do you recommend making the facade.registerMediator ?
2.
If I have views inside other views, I am doing this to register the mediators on the StartupCommand:
facade.registerMediator(new LocalesModuleMediator(app))
facade.registerMediator(new LocalesManagerMediator(app.localesManager));
facade.registerMediator(new LocaleEditorMediator(app.localesManager.localeEditor));
[...]
Is this the best approach?
3.
On the sendNotification method, what the purpose of the third argument (type) ?
4.
I have a view with several components (buttons, etc). I have a button that will change the current section on the application. What's the best approach:
a) The view registers for the click event of the button, and it's handler will dispach an event that the mediator should listen an react to change the application state
b) The mediator registers for the click of the button on the view, so everything is handled on the mediator
5.
The mediator should act only as a gateway between the views and the framework, or it is supposed to act also as a ViewHelper? In another words, imagine that I have a button that when clicked, it changes the currentState of the view. There is no need to access the framework, since everything needed is accessible on the view. The code to react to the click and change the currentState should be put inside the view component (the mxml file) or on the mediator? When should I make "reaction" code on the mediator?
6.
On the multicore version of PureMVC the facade is only available on the mediator after the call to the initializeNotifier. Where should I put the "addEventListeners" for the components on the view: on the constructor of the mediator, or on the initializeNotifier method?
Thank you! BTW, we are loving the PureMVC multicore.
João Saleiro