我需要在 Flex 3 中为单选按钮显示一些粗体单词。如下所示:
选项 1:你好world.
选项2:Hello world.
我看到单选按钮的标签没有 htmlText 属性。有人对完成这个要求有什么建议吗?
Thanks
Anji
@蒂莫菲·达维迪克
您可以通过扩展 RadioButton 并覆盖 updateDisplayList 函数,在 RadioButton 标签内包含 HTML 文本。您需要在此函数内将 textField 的 htmlText 属性更改为标签的值。
这是 HTMLRadioButton 组件
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:
如果您需要在 RadioButton 标签中使用多行 HTML,那么您需要扩展它成分 http://code.google.com/p/vizierfx/source/browse/trunk/Vizier/src/components/MultilineRadioButton.as?r=7与上面的方法相同。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)