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: Retrieving a mediator in a proxy  (Read 8632 times)
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« on: October 27, 2008, 12:00:17 »

I have a question about the above topic. is it ok to retrieve a mediator in a proxy class and perform some kind of action on it?? here is what is going on. i have a connection proxy class, which makes connection to fms server. when the connection is made, i attempt to grab the camera by using

Camera.getCamera( _camera );

now if a camera exists.. i want to do something like this

if (_camera)
{
      localVideo.video.attachCamera(_camera);
}

but localVideo is the id of an mxml component for the mediator whose proxy i am trying to construct. thats why i want to know...can i do this instead in the proxy

eg

_myMed = facade.retrieveMediator ( VideoPublisherMediator.NAME ) as VideoPublisherMediator;


that way the above if statement will look like this
if (_camera)
{
      _myMed.localVideo.video.attachCamera(_camera); <- retrieved mediator to use in proxy
}

can i do that? or is it bad practice? OR! can i dispatch/sendnotification that from the proxy and pass in the camera object in the body so the view can take over from there? :'( please help.
thanks
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: October 28, 2008, 05:36:52 »

Send a note that the Mediator is interested in.

The most important decoupling that MVC achieves is removing any knowledge of the View tier from the Model tier.

-=Cliff>
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #2 on: October 28, 2008, 07:52:11 »

thank you sir...got it!

Kofi
Logged
Pages: [1]
Print