Skip to main content
November 17, 2009
Question

TextFormatAlign.JUSTIFY doesn't appear to be working

  • November 17, 2009
  • 1 reply
  • 863 views

I have this in my code, but it doesn't seem to affect the the text in a single line text field that I am loading from XML. Can anyone offer a suggestion on how I can get my field to force justify one line of text?

var format:TextFormat = new TextFormat();

format.align = TextFormatAlign.JUSTIFY;
clientClip.characteristicClip.clientCharacteristic.text = clientData[flx]["characteristics"];
clientClip.characteristicClip.clientCharacteristic.defaultTextFormat = format;

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
November 18, 2009

Try assigning the defaultFormat before you assign the text.  To set it after assigning the text, I believe you need to use the setTextFormat() method.

November 18, 2009

Hi Ned, Thanks for the input. I tried moving it, without seeing any difference. I also had tried the setTextFormat() method previously to no avail. Also, do you know of a way I can dynamically change the width of that text field without stretching the text?

Ned Murphy
Legend
November 18, 2009

I tried your code before I replied earlier and the text did justify when I moved the defaultTextFormat line ahead of the text assignment, but I only had the one textfield by itself, not nested in others.  I then also tried it with the setTextFormat() method after the text was assigned and that also worked.  I also used a simple string instead of some xml defined data.

Try creating a standalone example like that as a new file and see if it still doesn't work.  I could say it could be a targeting issue since you have the textfield buried in other objects, but won't since you should see error messages if the target is not being found.