How to set the width of a component(HBOX) dynamically in flex

837 Views Asked by At

I have a custom component that is extending the HBOX. Am adding a VBOX and a "HBOX" to it as its children.The VBOX has a label which acts as title to component and adding/deleting a pair of LINK BUTTONS to the "HBOX" dynamically on a particular event(might be a button click).

The parent HBOX width must grow/shrink whenever the link button is added/deleted dynamically. How to calculate the same.I do not know.

2

There are 2 best solutions below

0
On BEST ANSWER

you can set width and height dinamically with this:

var hb:HBox;

hb.percentHeight = 100; //height:100%
hb.percentWidth = 100; //widht:100%
0
On

You can set width with percent (100%) or bind width property to another width property (in mxml with {}).