Works fine for me..
Is there an error? you are not seeing the box?
If I use:
I get the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Shape@5e2e3d1 to mx.core.IUIComponent.
Of course that's NOT gonna work.
Shape is a DisplayObject NOT UIComponent.
YOu can only add UIComponent to a UIContainer...
Do you mean I can only add a Shape to a UIContainer? I'm trying to understand how these hierarchies work. I think the idea is that a TextArea and a Canvas are both UIContainers, so a TextArea can be added to a Canvas, but a Shape is not a UIContainer, so it must be added directly into a UIContainer, but not into an object that just happens to also be a UIContainer. Does that make sense?
Do you mean I can only add a Shape to a UIContainer?
(No I mean you can add UIComponent to UIContainer NOT DisplayObject (Shape)..
I'm trying to understand how these hierarchies work.
DisplayObject (Shape, Sprite,.. ) > UIComponent > UIContainer...
If you want to add it to the canvas then Pls use
instead of this.addChild(goalBox).
Pls let me know if you still have any issue.
Shardul Singh Bartwal
The rules are:
Navigator (Viewstack, TabNavigator, Accordion) children must be mx.core.Containers
Container children must be IUIComponents
UIComponent children can be anything.
Conversely, a UIComponent's parent must be another UIComponent.
Flex SDK Developer
Adobe Systems Inc.