PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: olivier on April 23, 2009, 08:39:55



Title: which object create UIComponent ?
Post by: olivier on April 23, 2009, 08:39:55
Hello,

I'm trying to do a small game using PMVC and Flex. I have to create some objects on a map. I think they need a Mediator for each instance.
My question is : A proxy is telling me I need to create an object somewhere, but which object do the job ? The parent's view or the parent's mediator ?
I think the mediator of the child should be create by the parent's mediator but what about the view itself ?
thanks
Olivier


Title: Re: which object create UIComponent ?
Post by: puremvc on April 23, 2009, 10:19:44
You could do it inside the parent component itself and catch the event saying its added in the parent's mediator.

Or create it inside the parent's mediator, add it to the parent and register the mediator there.

If the component needs manipulating you might just want to do it all in a command.Build the component there, register the mediator for it and send a note to the parent mediator or retrieve it call a method to add the component.

It all depends on your app and how complex this step is for your choice. I'd probably go with middle or latter option in most cases.

-=Cliff>


Title: Re: which object create UIComponent ?
Post by: olivier on April 23, 2009, 10:26:45
tanks for the answer. I think I will go with the last one  ;)