views:

49

answers:

1

I want to create a HBox component name for example HLBox that behaves exactly like an HBox but ha s as default width and height 100%.

How can I do that?

+4  A: 

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>
Amarghosh