views:

184

answers:

3

Maybe I'm doing something wrong but I have a textarea where I've specified textAlign = center and if I type in text with several trailing spaces, it doesn't count the spaces towards centering the text. If I add another character to the text (after all the spaces) it then all of a sudden centers the line, is this a bug, can anybody think of a good solution?

To replicate:
-Create a textArea
-Set textAlign=center
-Run the application and type in something like 'FOOBAR' followed by 10 spaces, note that it centers FOOBAR but stops centering the text while you're typing the spaces
-Now type another string like 'WTF', now it'll all of a sudden center the whole line.

A: 

This is the default behavior in Flash. Even the low level flash.text.TextField, with alignment set to center, behaves like this. I think it makes sense too, as including white space in aligning may not be desirable in most situations. It would lead to the impression that the text is not aligned properly (as it would appear moved towards the left side of the text area).

Amarghosh
The use case here is previewing greeting cards for creation serverside and while a text area may be specified as 'centered' the user may want to offset certain lines for effect. Seems not uncommon.
Shizam
RichTextEditor control would be more appropriate for this use case it seems. http://livedocs.adobe.com/flex/3/langref/mx/controls/RichTextEditor.html
Amarghosh
A: 

there's a property called condenseWhite that according to the adobe docs "Gets or sets a Boolean value that indicates whether extra white space is removed from a TextArea component that contains HTML text."

Try switching this property to false

TheBrain
Good suggestion, tried that though and it doesn't help.
Shizam
A: 

I have the same problem. Was not able to find a solution. Any thoughts?

Nick