How to use htmlText as Radio button label in Flex 3

后端 未结 1 1973
别跟我提以往
别跟我提以往 2021-01-26 14:36

I need to show few words in bold for radio buttons in Flex 3. something like the following:

option 1: Hello world.

option 2: Hello world.

I

相关标签:
1条回答
  • 2021-01-26 15:11

    @Timofei Davydik

    You can include HTML Text inside RadioButton labels by extending RadioButton and overriding the updateDisplayList function. You need to change htmlText propert of textField to label's value inside this function.

    Here is the HTMLRadioButton Component

    package components
    {
    
    import mx.controls.RadioButton;
    
    public class HTMLRadioButton extends RadioButton
    {
      public function HTMLRadioButton()
      {
        super();
      }
    
       override protected function updateDisplayList(unscaledWidth:Number,
                                                  unscaledHeight:Number):void
       {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            textField.htmlText = label;
    
       }
    }
    }
    

    Update:

    If you need multiline HTML in RadioButton label, then you need to extend this component in the same way as above.

    0 讨论(0)
提交回复
热议问题