开发者

How do I make this linkButton custom component work?

package {
 import mx.controls.LinkButton;
 import flash.text.TextLineMetrics;

 public class multiLineLinkButton extends LinkButton {
      override protected function createChildren():void {
           super.createChildren();
           if (textField){
                textField.word开发者_如何学编程Wrap = true;
                textField.multiline = true;

           }
      }

      override public function measureText(s:String):TextLineMetrics {
           textField.text = s;
           var lineMetrics:TextLineMetrics = textField.getLineMetrics(0);
           lineMetrics.width = textField.textWidth;
           lineMetrics.height = textField.textHeight;


           return lineMetrics;
      }
 }

my issue here is if you use this component you will see that the text is bunched up into a very small area. It does not fill the entire width of the linkButton. Anyone know why this is happening?


The container is probably not wide enough. Set the container percentWidth to 100 and see if it fixes your problem. You can also set the LinkButton to a fixed width and see if that helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜