About Me

My photo
Derek lives in Wall Street, Lee-Over-Sands, St Osyth. A mobile and event software/product designer by trade - and is keen to improve things for all the local residents - and has lived in this idyllic location since 2009.

Saturday, 10 October 2009

Text Alignment issues

Here's another Flash odd behaviour. Lets say you have a movieclip template with a dynamic text field. Lets say you want to dynamically work with said text field and scale it, then reset its alignment e.g. "left", "right", "centre" using text.align?... And it doesn't work.

You're confused because the code syntax is fine and you've followed the manual documentation to the letter...
var format:TextFormat = new TextFormat(); format.align = "justify";

If it doesn't work as expected and always stays left aligned, After a bit of head and wall banging, I discovered that this bug is caused by the "Line Type" box settings for the object in the properties window... if this is set to "single line" it won't react to your code - changing it to "multiline" makes it work, and your align code will suddenly work properly!

No comments:

Post a Comment