views:

139

answers:

1

I have 1 class (that is extending a UIcomponent) that is representing a component. In that component I create different instances of another class that is also a UIComponent but this class doesn't show up in de first class. I see that it is running and that it has the correct hights but I got the feeling that it doesn't show up with this hights. If I trace I see the width and height is 200 X 200 but there is still nothing visible in my component

I bet there is a simple solution for this problem?

A: 

If extending UIComponent directly, you have to make sure to override all the right methods, including createChildren, updateDisplayList, and measure. If you miss any of those it won't work.

Remember to addChild in createChildren, to set x, y, width, and height in updateDisplayList, and to set your own measured properties in measure.

"Fixing" it by "setting everything in one UIComponent" is probably not the right idea.

That said, it's usually A LOT easier to just put stuff into a canvas instead of extending UIComponent. Everything will show up by default, and you don't have to override anything. I only extend UIComponent when I'm doing something really fancy or I want custom control

Sean Clark Hess