How to use htmlText as Radio button label in Flex 3

房东的猫 提交于 2019-12-02 09:31:32

@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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!