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] On
Behalf Of Richard Rodseth
Sent: Thursday, August 21, 2008 2:28 PM
To: [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?

 

Reply via email to