在flex 3中,如何使复选框标签的一部分以粗体显示? 说复选框标签是“记住datagrid上的值”。需要使文本“datagrid”单独加粗。任何人都可以请帮助。 提前谢谢。
答案 0 :(得分:0)
这不是一个完美的解决方案,但它会让你开始。如果扩展CheckBox类,则可以覆盖updateDisplayList()
方法,并使用htmlText
属性设置复选框的标签。
然后使用此自定义复选框并使用HTML传递标签。
此解决方案的问题:
measure()
Flex生命周期方法)htmlText
属性HTMLTextCheckBox.as:
package
{
import mx.controls.CheckBox;
public class HtmlTextCheckBox extends CheckBox
{
public function HtmlTextCheckBox()
{
super();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
textField.htmlText = label;
}
}
}
使用它MXML:
<local:HtmlTextCheckBox label="this is the <b>bold part</b>"/>
或者在AS3中:
var cb:HtmlTextCheckBox = new HtmlTextCheckBox();
cb.text = "this is the <b>bold part</b>";