tags:

views:

45

answers:

1

Is it bad practice/design to nest components inside components using Flex 4? Should I simply be creating components and inserting them into my main application as below, or doesn't it matter?

<com:MyComp1>
    <com:MyComp2>
        <com:MyComp3>
            <s:Label text="This is a test."/>
        </com:MyComp3>
    </com:MyComp2>
</com:MyComp1>
+1  A: 

If MyComp1, MyComp2 and MyComp3 are a containers then it's the recommended workflow. Custom containers in Flex 4 usually extend SkinnableContainerBase or Group. If the given code is used more than once then it's recommended to refactor it into a custom big component.

If they are not designed to contain unknown visual elements then it's a bad practice. Defining components inline is also known as bad practice in production code.

Maxim Kachurovskiy
Thanks. Could you give any examples of unknown visual elements please?
Reado
Just any element - `<s:Label />`, `<s:Panel />`, etc.
Maxim Kachurovskiy