--- In [email protected], "gary_mangum" <[EMAIL PROTECTED]> wrote: > > 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! >
Check out the SecureApplication class I posted on livedocs http://livedocs.adobe.com/flex/201/langref/mx/core/Application.html Basically it overrides the addChild function and adds a check to see if someone has logged in before actually running it, otherwise it queues it up with callLater until all criteria are met.

