Search code examples
apache-flexsizeflex2

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


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.


Solution

  • you can set width and height dinamically with this:

    var hb:HBox;
    
    hb.percentHeight = 100; //height:100%
    hb.percentWidth = 100; //widht:100%