This content has been marked as final. Show 4 replies
Ahh the joy of OOP Graphic libraries. I found the answer, but the explanation is beyond me at this point.
Components have two types of children, content children and non-content children.
Content children are placed in the component where the component acts as the container. Non-content children are placed on the component where they make up the component.
e.g. I can add a Label to a Canvas using addChild. I can add a background to a Canvas using rawChildren.addChild.
To use an analogy, an apple can be placed in a basket with addChild while an handle can be added to the basket with rawChildren.addChild.
Thanks for the apple analogy it helps. Looking at the class library, which components are content children and non-content children. Is there a rule of thumb? Maybe the inheritance ?
Actually in this case the standard way of doing this is to wrap the shape in a UIComponent:
var uic:UIComponent = new UIComponent();