How do I make this linkButton custom component work?

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2010-04-05T23:56:25Z Indexed on 2010/04/06 0:03 UTC
Read the original article Hit count: 193

Filed under:
package {
 import mx.controls.LinkButton;
 import flash.text.TextLineMetrics;

 public class multiLineLinkButton extends LinkButton {
      override protected function createChildren():void {
           super.createChildren();
           if (textField){
                textField.wordWrap = 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?

© Stack Overflow or respective owner

Related posts about flex