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: which object create UIComponent ?  (Read 7565 times)
olivier
Newbie
*
Posts: 6


View Profile Email
« 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



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


View Profile Email
« Reply #2 on: April 23, 2009, 10:26:45 »

tanks for the answer. I think I will go with the last one  ;)
Logged
Pages: [1]
Print