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: my view component needs a mediator  (Read 11022 times)
joskoomen
Newbie
*
Posts: 6


View Profile Email
« 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
Logged
Sammi
Courseware Beta
Full Member
***
Posts: 45


View Profile Email
« Reply #1 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
Logged
joskoomen
Newbie
*
Posts: 6


View Profile Email
« Reply #2 on: June 04, 2009, 05:25:47 »

easy as that..   ;D

Thanks
Logged
joskoomen
Newbie
*
Posts: 6


View Profile Email
« Reply #3 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
Logged
Sammi
Courseware Beta
Full Member
***
Posts: 45


View Profile Email
« Reply #4 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
Logged
joskoomen
Newbie
*
Posts: 6


View Profile Email
« Reply #5 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!

Logged
Pages: [1]
Print