0
我将标签直接从我从Google API接收的字符串中添加html来格式化标签,从而将标签添加到我的LinkButton。如何扩展LinkButton以在Flex中允许HTML文本?
我想扩展linkbutton来允许这个。我自己写了一个类来允许标签的html文本,并且它的这个方面有效,但是现在当你悬停的时候出现的背景太大了。我试图覆盖measure()来解决这个问题,但我不知道如何。这里是我写的类:
package com.kranichs.components
{
import mx.controls.LinkButton;
public class HTMLLinkButton extends LinkButton
{
protected var _isHTML:Boolean;
public function HTMLLinkButton()
{
super();
}
[Bindable]
public function set isHTML(value:Boolean):void
{
_isHTML = value;
}
public function get isHTML():Boolean
{
return _isHTML;
}
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(_isHTML)
{
textField.htmlText = label;
}
}
}
}
谢谢!我错过的主要关键是使用mx_internal命名空间。还不确定这行代表什么意思,但是直到我在表达式中添加“或者”,才会起作用: if(FlexVersion.compatibilityVersion
2009-05-26 19:36:28