PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: joskoomen on May 26, 2009, 02:36:37



Title: my view component needs a mediator
Post by: joskoomen on May 26, 2009, 02:36:37
Hi there..
I'm new to pure mvc in as3.

I have a stage mediator where i create a navigation view.
But my navigation has to listen to some notifications.
and so as i believe i need a mediator for my view.

I have in my StageMediator class the next code:
:
_navigationView = new NavigationView(_styleSheetProxy.css);
stage.addChild(_navigationView);

How can i add a mediator?
do i add it in my view class NavigationView or hre on my Stage Mediator?
And how?

Kind regards, Jos


Title: Re: my view component needs a mediator
Post by: Sammi on May 26, 2009, 03:23:42
Hi,

just like you created your StageMediator and passed the stage as a view.  In your StageMediator you can register a NavigationMediator and pass the _navigationView to it.

Best,
Sammi


Title: Re: my view component needs a mediator
Post by: joskoomen on June 04, 2009, 05:25:47
easy as that..   ;D

Thanks


Title: Re: my view component needs a mediator
Post by: joskoomen on June 04, 2009, 07:09:05
This is what i do.. but i don't really know where to put stuff..

In my ApplicationFacade i create a StageMediator

Now i create a NavigationMediator also in my ApplicationFacade? Or in my StageMediator?

In my Navigation i need several buttons. Do i need to create them in my viewComponent or in the navigationMediator?

The button mousevents are in the mediator where i send a notification to show another page.

THe thing is where i just losing it is where to and how to add the navigationview to the stage.

Cheers


Title: Re: my view component needs a mediator
Post by: Sammi on June 04, 2009, 07:31:25
Hi,

I would create the NavigationMediator in the StageMediator.

I would create the buttons in the viewComponent.  The buttons in the view component dispatch an event on mouse click and the NaviagationMediator listens to them and send  an appropriate notification.

The StageMediator could add the navigation view to stage for an example.

I usually have one ApplicationMediator that adds the main views to the stage and registers mediators for them.  Your StageMediators would do that in your case I believe.

Best,
Sammi


Title: Re: my view component needs a mediator
Post by: joskoomen on June 04, 2009, 12:01:08
Ok that sounds reasonable..
I will go and work on that one!

i'll let you know.

thanks for your time!