You understand that if you use navigation containers, like viewStack and
TabNavigator, that much of this is done for you automatically?

 

Also, separate mxml files is a fine way to make re-useable components.
Their size is not significant.  Make them generic so that you can set
properties and event listeners.

 

I don't know if the <mx:Component> tag can be used anywhere other than
in an item renderer(state?), but you might check.

 

And you can instantiate controls at will using container.addChild().

 

There are also RSLs and modules.

 

Mxml is just another way to write AS classes, use it if you like it.

 

There are lots of options.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of gary_mangum
Sent: Tuesday, May 29, 2007 6:30 PM
To: [email protected]
Subject: [flexcoders] Defining a dynamic UI

 

Is it possible to "pre-define" a set of MXML components but not create
them or add them to a Container in the application until a later time.
In other words, I want to define some components, complete with
properties, events, etc. that will not be part of my UI until I
dynamically add them as the application runs. I will decide whether
or not to add them based on runtime criteria.

I know that I can use states to add and remove components. If I use
states, is there a way to define a component only once in MXML and
then add it in 3-4 different states? I do not wish to define my
component over and over inside of AddChild tags, and my components are
not really specialized enough to warrant their own MXML files since
there are many of them and the only real differences are their
properties, events, etc.

I've also thought that I could manually define my components in AS and
keep them in memory until needed, but would rather define them in MXML
if possible. I would also like to create the components
"just-in'time" instead of creating them up front when they may never
be needed.

Anyway, thanks for any thoughts on this topic!

 

Reply via email to