IMHO, in a strict MV architecture you wouldn't know there were child display objects like left and right. Any interface at all would standardize a set of properties where you might set model data
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Rodseth Sent: Thursday, August 21, 2008 10:18 PM To: [email protected] Subject: Re: [flexcoders] Template architecture Hmm. The way I have it, the templates are dead simple to write and can have any Container as the root, eg. <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " > <mx:VBox id="Left" width="20%" height="100%"/> <mx:VBox id="Right" width="80%" height="100%"/> </mx:HBox> and all that's exposed is the names of the containers "Left" and "Right" (via an implemented interface I've omitted above). But I suppose I could provide a template base class (probably a subclass of Box) with a contentSpec property and an init function to build out the containers - much like what the LiveDocs call templates, a pattern I use elsewhere. Only downside is if the template wants non-Box behaviour at the top level it must nest a Canvas or whatever. No biggie. On Thu, Aug 21, 2008 at 9:27 PM, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: creationCOmplete is a better bet, but pushing stuff into the template is potentially bad design. It means you know something about the template and have broken encapsulation. Other designs like model/view would have the template pull from a data model. Other designs would have an interface to the template that abstracts what children do what. That's how many of our components work and they use the lifecycle events and methods to validate properties "later" ________________________________ From: [email protected] <mailto:[email protected]> [mailto:[email protected] <mailto:[email protected]> ] On Behalf Of Richard Rodseth Sent: Thursday, August 21, 2008 2:28 PM To: [email protected] <mailto:[email protected]> Subject: [flexcoders] Template architecture I'm prototyping a system where a view is built dynamically from an XML description (converted to VOs). The description refers to a template (hard-coded in MXML). The dynamic view observes the description (which is a part of its model) , and creates a child (the template) and adds it as a child. However, it also needs to "fill in" the template which involves accessing some of its children by id (eg. template["slot1"], template["slot2"] ). If I construct the template via new Template1(), the children are not yet created. Their ids show up in the debugger, but the values are null. Should I add a listener for creationComplete, or is this a case where callLater() could be put to good effect?

