Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 567027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:02:22+00:00 2026-05-13T13:02:22+00:00

I only really need the HBox answer but figure that if we get a

  • 0

I only really need the HBox answer but figure that if we get a good answer in here it would help anyone trying to do a similar thing with a VBox. It would be nice to know this in both actionscript and MXML.

So I have an HBox that I want some text aligned from the left and some radios from the right. Like so:

 ___________________________________________________
|                                                   |
|Text                                Yes ()  No()   |
|___________________________________________________|

I am currently doing this by having an invisible box with a width of 100% between the text and the radios, like this

 _____ __________________________________ ________________
|     |                                  |                |
|Text | invisible box  percentWidth=100; | Yes ()  No()   |
|_____|__________________________________|________________|

I would prefer to just have the radios in their own HBox that is right aligned like this:

 _____ ________________________________________________________
|     |                                                        |
|Text |                                         Yes ()  No()   |
|_____|________________________________________________________|

I’ve seen some posts talk about a horizontalAlign property, but I don’t see it in the documentation anywhere.

So how can I accomplish this?

Thanks
~mike

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:02:22+00:00Added an answer on May 13, 2026 at 1:02 pm

    There is a horizontalAlign property, and a verticalAlign property, on the VBox and HBox components (it’s inherited from Box). They determine the horizontal and vertical alignment of the component’s children.

    I generally use the Spacer object, like Sam mentions. But for what you want to do, this will work great.

    In MXML you could do something like:

    <mx:RadioButtonGroup id="yesNoRadioGroup"/>
    
    <mx:HBox id="containingHBox" width="100%">
        <mx:Text id="textElement" width="200" text="lakdfa lkadslkjraklnd kadflk lakdsjlkja lksdlkjdflk jalkdlkjdfslksajdf lkjasdflkjdsalkjds lksdjlkj"/>
        <mx:HBox id="rightAlignedHorizontalContent" width="100%" horizontalAlign="right">
            <mx:RadioButton id="yesRadio" label="Yes" groupName="yesNoRadioGroup"/>
            <mx:RadioButton id="noRadio" label="No" groupName ="yesNoRadioGroup"/>
        </mx:HBox>
    </mx:HBox>
    

    Note that the HBox with the horizontalAlign set has to have a width value, otherwise, it will only be wide enough to accommodate the width of its children, in which case alignment is moot.

    Here’s an AS version:

    <mx:Script>
        <![CDATA[
            import mx.controls.RadioButton;
            import mx.controls.RadioButtonGroup;
            import mx.controls.Text;
    
            private var containingHBox:HBox;
            private var textElement:Text;
            private var rightAlignedHorizontalContent:HBox;
            private var yesNoRadioGroup:RadioButtonGroup; 
            private var yesRadio:RadioButton;
            private var noRadio:RadioButton;
    
            override protected function createChildren():void
            {
                super.createChildren();
    
                containingHBox = new HBox();
                containingHBox.percentWidth = 100;
    
                textElement = new Text();
                textElement.width = 200;
                textElement.text = "lakdfa lkadslkjraklnd kadflk lakdsjlkja lksdlkjdflk jalkdlkjdfslksajdf lkjasdflkjdsalkjds lksdjlkj";
    
                rightAlignedHorizontalContent = new HBox();
                rightAlignedHorizontalContent.percentWidth = 100;
                rightAlignedHorizontalContent.setStyle("horizontalAlign","right");
    
                yesNoRadioGroup = new RadioButtonGroup();
    
                yesRadio = new RadioButton();
                yesRadio.label = "Yes";
                yesRadio.groupName = "yesNoRadioGroup";
    
                noRadio = new RadioButton();
                noRadio.label = "No";
                noRadio.groupName = "yesNoRadioGroup";
    
    
                addChild(containingHBox);
    
                containingHBox.addChild(textElement);
                containingHBox.addChild(rightAlignedHorizontalContent);
    
                rightAlignedHorizontalContent.addChild(yesRadio);
                rightAlignedHorizontalContent.addChild(noRadio);
            }
        ]]>
    </mx:Script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.