There probably isn't one right way.  It depends a bit on how you and the users 
think about it.

MXML Containers have a childrenAdded method that gets called.  That method 
should be dispatching a "childrenAdded" event, but "childrenAdded" also is 
dispatched when anyone calls addElement at runtime.

You also have to consider whether users will be able to call 
addElement/removeElement at runtime to add/remove children from the container 
and how you will respond to that.

MXML is supposed to be declarative "I want these components" and so anything 
else added "should be chrome".  The TextPromptBead floats a text widget with 
the prompt over a TextInput it expects in the view.  Accordion inserts Buttons 
between the views.

MXMLBeadView is meant to allow someone to completely replace some default view 
with a view written in MXML.  Such as replacing the default TitleBar on a Panel 
with a TitleBar with resize/min/max buttons.

In some cases, an "optional" component that is a peer of the other components 
and not chrome shouldn't be a bead at all, but just a component that someone 
adds when they want it.  IOW, if they wanted it enough to place it on the beads 
list, why not just let them place it among the children as any other MXML tag?

Also, remember that the child tags of the top tag in MXML are really just being 
assigned to a default property called "mxmlContent".  It is special cased and 
converted to an array of bytes that MXMLDataInterpreter uses to generate the 
children.  You could add other properties.   Panel has a titleBar that lets you 
specify another set of children.  If we did a PanelWithStatusBar it could have 
a statusBar property.

HTH,
-Alex

On 11/6/18, 2:40 PM, "Carlos Rovira" <[email protected]> wrote:

    Hi
    
    I have an MXML component with several form controls and the las set of
    controls are only used some times (in some instances of that MXML
    component). So I'm creating that part as an IBead.
    
    I want to know what's the recommend way to make this bead be added to the
    strand when the rest of MXML controls are already added (so it will be
    added to the final part of the MXML component. Right now is added to the
    start and then added the rest of controls.
    
    Additionaly, although is not a current need, what if I want to be added in
    some intermediate part of the main component? how can this be done?
    
    The bead is implemented trying to ways:
    a) as a simple .as class that implements IBead and use
    
    IParent(value).addElement(new Button());
    
    b) as an MXML extending MXMLBeadView (since the bead is complex with an
     VGroup an various internal controls and things, this will be the preferred
    way, but maybe in this way the main MXML will think that this optional bead
    is its BeadView, but is not the case, is just an optional visual piece.
    So declaring the internal content in an MXMLBeadView is a complete mystery
    to me how can I rearrange this content to get the desired position inside
    the main MXML component
    
    thanks for your help
    
    -- 
    Carlos Rovira
    
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7C1b3992daa6e64aa079c808d64438e9b4%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636771408561425502&amp;sdata=shuuJdkwJo%2BhyHkjPTGRULa5ePoAtKhD0EJIOYefUnI%3D&amp;reserved=0
    

Reply via email to