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 113155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:39:28+00:00 2026-05-11T02:39:28+00:00

Consider the following radio button example. <?xml version=1.0 encoding=utf-8?> <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml> <mx:Script> <![CDATA[ private

  • 0

Consider the following radio button example.

<?xml version='1.0' encoding='utf-8'?> <mx:Application xmlns:mx='http://www.adobe.com/2006/mxml'> <mx:Script> <![CDATA[     private function getRb1():RadioButton {         trace(rb1 == null);         return rb1;                          }    ]]>  </mx:Script> <mx:VBox>     <mx:RadioButtonGroup **id='rbg' selection='{getRb1()}**'/>           <mx:RadioButton id='rb1' label='Radio Button 1' />     <mx:RadioButton id='rb2' label='Radio Button 2' />     <mx:RadioButton id='rb3' label='Radio Button 3' /> </mx:VBox>    </mx:Application> 

The problem is that I can not refer to rb1 while defining RadioButtonGroup, rb1 is null at that time, but i can use the selectedValue to set the initial selction.

I was just wondering is this some special case or its not safe to refer to components in mxml in general.

Thanks,

  • 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. 2026-05-11T02:39:29+00:00Added an answer on May 11, 2026 at 2:39 am

    I’m not quite sure what you’re asking, but hopefully this’ll answer your question — from the Flex docs:

    RadioButtonGroup.selection
    Contains a reference to the currently selected RadioButton control in the group. You can access the property in ActionScript only; it is not settable in MXML. Setting this property to null deselects the currently selected RadioButton control.

    In general, though, making component references in MXML is totally fine; that’s how effects are often handled, among many other things. For example:

    <mx:Glow id='g' /> <mx:Label showEffect='{g}' /> 

    However in your case, assuming you’re having trouble setting the selected item, it might be because you haven’t specified the group attribute on the radio buttons; omitting that detaches the group component from the individual buttons. Once you add that, you can bind the group’s selection property using a Bindable variable containing a reference to a component, like so:

    <mx:Script>     <![CDATA[          [Bindable]         private var selectedRadioButton:RadioButton;              private function this_creationComplete(event:Event):void         {             selectedRadioButton = rb1;         }          private function btn_click(event:Event):void         {             selectedRadioButton = rb2;         }      ]]>  </mx:Script> <mx:VBox>     <mx:RadioButtonGroup id='rbg' selection='{selectedRadioButton}' />     <mx:RadioButton id='rb1' group='{rbg}' label='Radio Button 1' />     <mx:RadioButton id='rb2' group='{rbg}' label='Radio Button 2' />     <mx:RadioButton id='rb3' group='{rbg}' label='Radio Button 3' />      <mx:Button label='Choose a Different Button' click='btn_click(event)' /> </mx:VBox>  

    Does this make sense? Hopefully it’s not completely off the mark; post back and let me know and I’ll try to help out as best I can.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 111k
  • Answers 111k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to set the VerticalContentAlignment on the list box,… May 11, 2026 at 9:48 pm
  • Editorial Team
    Editorial Team added an answer I've never had to do this before in Flex, but… May 11, 2026 at 9:48 pm
  • Editorial Team
    Editorial Team added an answer You can use parse_str to parse the string for arguments.… May 11, 2026 at 9:48 pm

Related Questions

The background In .NET Windows Forms (2.0) radio buttons are automatically grouped by their
Consider the following setup: A windows PC with a LAN interface and a WiFi
Consider the following ruby code test.rb: begin puts thisFunctionDoesNotExist x = 1+1 rescue Exception
Consider the following 2 queries: select tblA.a,tblA.b,tblA.c,tblA.d from tblA where tblA.a not in (select

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.