开发者

How to use htmlText as Radio button label in Flex 3

开发者 https://www.devze.com 2023-02-23 06:20 出处:网络
I need to show few words in bold for radio buttons in Flex 3. something like the following: option 1: Hello world.

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 see that there is no htmlText prop开发者_JAVA技巧erty for label of Radio Button. Anyone has any suggestions in accomplishing this requirement?

Thanks

Anji


@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

精彩评论

暂无评论...
验证码 换一张
取 消