R – create HBox component with default values

actionscriptactionscript-3apache-flexflex3

I want to create an HBox component; for example HLBox that behaves exactly like an HBox but has as default width and height 100%.

How can I do that?

Best Answer

Create a HLBox.mxml file and add the following code to it.

<!-- HLBox.mxml -->
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
    width="100%" height="100%"/>

And use HLBox as you would use HBox

<HLBox>  
   <!-- Don't specify width or height attributes to HLBox tag, 
      it will overwrite the default ones -->
   <mx:Label text="something"/>
   <!-- other children -->
</HLBox>
Related Topic