PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: Durairaj on June 29, 2009, 02:55:26



Title: Mediator and view component
Post by: Durairaj on June 29, 2009, 02:55:26
I have some clarifications on Mediator and view component coupling. Lets say i want to display some text on certain events. The text is basically a clip which is available in the library but not added on stage. In mediator constructor i am getting the stage reference as a view component and i am instantiating the clip in a particular notification say CONSTRUCT_LAYOUT. i am adding that particular clip at on the corresponding event to the stage using getter of that viewcomponent and by passing the clip reference as an argument to addchild. The issue is the clip component needs to be imported in mediator class. It works fine. But the problem is ,if i needed to have a different clip that needs to  use the same functionality of the mediator, but having different characteristics in their visual of the component?

Is that i need to pass the clip reference as an argument to view component instead of the stage reference.?

I am confused!! Any help will be much appreciated on the problem

Thanks



Title: Re: Mediator and view component
Post by: puremvc on June 30, 2009, 12:59:52
Create a StageMediator and send it notifications containing the child to be added. Have it cast the body to Sprite or MovieClip, whichever. Then send the children to be added from their Mediators, and have the StageMediator add them to the stage.

-=Cliff>