PDA

View Full Version : .. do i ALWAYS have to use setTextFormat every time i change the text?


brisque
04-01-2008, 08:09 PM
i'm going crazy, i'm making a LOT of adjustments per second to various textfields by simply doing

something.text += "whatever";

But i have to call setTextFormat every single time or the textfield loses its formatting.. this is driving me crazy.. is there any way to retain the format once and for all??

dr_zeus
04-01-2008, 08:16 PM
Check out the defaultTextFormat property. Set it once and the TextField will always use that TextFormat by default.

allenrabinovich
04-02-2008, 04:56 AM
i'm going crazy, i'm making a LOT of adjustments per second to various textfields by simply doing

something.text += "whatever";

But i have to call setTextFormat every single time or the textfield loses its formatting.. this is driving me crazy.. is there any way to retain the format once and for all??

Also, as a matter of optimization, consider using TextField's appendText method, rather than concatenating new strings onto the text property. appendText is a LOT more efficient.

amagill
01-26-2010, 10:47 PM
I know its 2 years later but... Thanks Dr_Zeus! That was the exact property that I needed.

I did notice strange behavior though. If I set the default format after I have already added text to the field, the format is only set for the next string I add with appendText. Then it reverts to the previous default format.Luckily, for this particular project, I don't care about this quirk.