I have a fl.controls.Button
that I set to size (w:300, h:200). I then add this button to an empty 'container' sprite. From what I understand, the children of a display objects are taken into account when looking at the display object's width/height parameters. But this does not seem to be entirely true for the button object?
For example:
var container:Sprite = new Sprite();
trace(container.width, container.height); // 0 0
var btn:Button = new Button();
btn.setSize(300, 200);
this.addChild(container);
container.addChild(btn);
trace(btn.width, btn.height); // 300 200
trace(container.width, container.height); // 100 100 - Why??
var rectangle:Sprite = new Sprite();
rectangle.graphics.drawRect(0, 0, 500, 400);
container.addChild(rectangle);
trace(container.width, container.height); // 500 400
Why is the container not given the same width/height values as the button, as it is the only thing inside the sprite. Similarly, if instead I write setSize(40,40)
, the container still goes to size 100x100. It's making it hard for me to determine the vertical size of a container with many buttons inside of it.