Apache – Positioning text in Flex

apache-flex

I want to display three different pieces of text in a line underneath a VBox so I've created a HBox and place the Text components in here:

<mx:HBox width="100%">
    <mx:Text text="left" id="textLeft"/>
    <mx:Text text="center" id="textCenter"/>
    <mx:Text text="right" id="textRight"/>
</mx:HBox>

I want the text with id "textLeft" to be positioned on the very left on the HBox and textCenter to be in the center and textRight to be on the right…

Any solutions/pointers appreciated.

Best Answer

try

<mx:HBox width="100%">
    <mx:Text text="left" id="textLeft"/>
    <mx:Spacer width="100%" />
    <mx:Text text="center" id="textCenter"/>
    <mx:Spacer width="100%" />
    <mx:Text text="right" id="textRight"/>
</mx:HBox>

or

   <mx:HBox width="100%">
        <mx:Text text="left" id="textLeft" textAlign="left" width="100%"/>
        <mx:Text text="center" id="textCenter"  textAlign="center" width="100%"/>
        <mx:Text text="right" id="textRight"  textAlign="right" width="100%"/>
   </mx:HBox>

Personally I'd go with the top one

Related Topic