# DividedBox Subclass Doesn't Work as Child of UIComponent

**URL:** <https://forum.kirupa.com/t/dividedbox-subclass-doesnt-work-as-child-of-uicomponent/232746>\
**Category:** flash\
**Created:** [July 17, 2007, 1:36pm UTC](https://forum.kirupa.com/t/dividedbox-subclass-doesnt-work-as-child-of-uicomponent/232746 "2007-07-17T13:36:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [July 17, 2007, 1:36pm UTC](https://forum.kirupa.com/t/dividedbox-subclass-doesnt-work-as-child-of-uicomponent/232746/1 "2007-07-17T13:36:39Z")

</div>

Hello,

let me explain how. I tired to isolate the problem in my project so its limited to this:

class **Holder** : UIComponent subclass, the only thing it does is create an instance of DividedBoxTest and add it to its displaylist

```auto
public function Holder()
{
    super();
    
    addChild ( new DividedBoxTest () );
}

```

class **DividedBoxTest** : Nothing but a subclass of DividedBox that adds few children to itself as some content

```auto
public function DividedBoxTest()
{
    super();
            
    addChild ( new Button () );
    addChild ( new Button () );
}

```

I also have a css file with this:

```auto
DividedBoxTest
{
    background-color : #ff0000;
    left : 0;
    right : 0;
    top : 0;
    bottom : 0;
}

Holder
{
    background-color : #00ff00;
    left : 0;
    right : 0;
    top : 0;
    bottom : 0;
}

```

So nothing that wouldn’t be alright to my understandings.

Now in my application mxml file upon applicationComplete event, I call either

```auto
addChild ( new Holder () )

```

or

```auto
addChild ( new DividedBoxTest () )

```

Simple instance of DividedBoxTest works great, but if I create an instance of Holder, nothing gets displayed.

I was playing with it in my project and the debugger showed that all children were created, added etc., but the DividedBox subclass had zero width and height. When I tried to sets its size, it worked, but only in something like

```auto
var box : DividedBoxTest = new DividedBoxTest ()
box.width = 500;
box.height = 200;

```

and if I would try to set its size in Holders updateDisplayList, it would seem that it showed the background, but the rest was still at zero size as no children were visible.

Does anybody know why this would happen? Why it won’t size properly by itself, ignore left/right/etc? It doesn’t seem as I’m doing anything wrong ☹

Thanks for any help.
