0 Replies Latest reply on Nov 17, 2006 11:23 AM by teresad

    truncateToFit and problems with text on LinkButtons

    teresad
      We're using LinkButtons with lots of text. There are two problems:

      1. If I don't add a blank space at the end of the string, the last letter of the LinkButton's text string is clipped in half, regardless of the length of the text string. Note that because the length of the text strings vary, we did not specify a Width for the LinkButtons. The text is grabbed dynamically from an XML.

      2. When the length of the text is too long for the real estate allotted to the LinkButton (about 500 pixels), the text is getting truncated with an ellipsis (...), which is fine, but due to the first problem, we only see one dot, so it just looks like a period.

      I'm hoping I can circumnavigate these two problems by changing the truncation string from 3 dots to 5 or 6. However, I've been unsuccessful. Can someone give me an example? The help is pretty vague here.

      Here's a code snippet:

      var ql:LinkButton = LinkButton(questionLinks.getChildAt(i+2));
      ql.visible = true;
      ql.label = nodeList .text() + ' '; // need a space at the end to avoid weird display problem when we don't specify width
      linkNodeId = nodeList
      .attribute("id");
      ql.name = linkNodeId;
      ql.truncateToFit('.....'); // this causes a compile error

      The error is:
      "Error: Call to a possibly undefined method truncateToFit through a reference with static type mx.controls: LinkButton."