On 7/16/13 1:57 PM, "flexcapaci...@gmail.com" <flexcapaci...@gmail.com>
wrote:

>>A) wrapping addChild messed up a lot of low-level tools like display list
>> tree walkers used in Spy-like programs.  I'm leaning against wrapping
>> addChild again.
>>
>
>What happened?
To walk the entire display list, you have to anticipate that there could
be IRawChildren containers in the tree.  Otherwise, simply looping over
numChildren via getChildAt would miss chrome widgets like borders,
titlebars, and backgrounds.

>
>
>
>> B) addToParent requires that the child have some knowledge about the
>> parent.  Maybe it is better for the parent to have some knowledge about
>> the child.
>>
>
>
>> C) addToParent worked well for simple control composition, but when I
>> ended up having to abstract out the actual parent when managing
>>container
>> children on the AS side I ended up with an "internal" addChild contract
>> anyway.
>>
>
>But in my opinion the control should be concerned with itself. It should
>be
>concerned with how it behaves and how it appears visually at different
>sizes. It's layout, depth and relation to container and other controls
>should be a concern of the parent container IMHO. For example, you have
>graphic elements like rect and circle. Their only job should be to draw
>their visuals. On the other lazier hand you could save time by NOT
>requiring every visual element implement an addToParent / removeFromParent
>like methods and interface.
Yes, I think those are arguments for changing away from addToParent to
addElement.

>
>One method I've seen is the layout and position reside outside the control
>(maybe you are doing this already). For example, there is a specific
>object
>that contains the layout properties:
>
>    <LayoutObject target="{container1}" top="10" right="50" width="100%"
>height="100%"/>
>
>    <BasicContainer id="container1" >
>        <LayoutObject left="10" top="50" width="220" height="25">
>             <Button id="button1" label="Hello World"/>
>        </LayoutObject>
>
>        <AdvancedLayoutObject target="button2" left="button1:10"
>top="button1:50" width="220" height="25"/>
>        <Button id="button2" label="Hello World"/>
>
>        <HorizontalLayoutObject left="10" top="250" width="220"
>height="25"
>gap="10">
>             <Button id="button3" label="Hello World"/>
>             <Button id="button4" label="Hello World"/>
>             <Button id="button5" label="Hello World"/>
>        </HorizontalLayoutObject>
>     </BasicContainer>
>
>I'm not sure where I'm going with this... except that I've seen this and
>there may be a situation where the controls are never "added" to the
>object
>that lays them out. This could be the case with canvas or absolutely
>positioned nested elements.
Too much typing and too many objects IMO, but thanks for making me aware
of this option.

-Alex

Reply via email to