gabriel montagné láscaris comneno

Animating Text in Flex Gotcha

Have you ever tried to animate and scale text in Flex only to see it nervously wobble, shake, tremble, quaver or some other keyword I'm hoping will bring you here from a search engine?

At work, my friend Jeff Yamada stumbled into this. In the end we figured out what the problem was and how to fix it (with no fancy bitmap caching or anything like that).

You must set the fontGridFitType to match what you need to do. The default setting, "pixel", will not work for animating left-aligned text fields. Checking the docs one can see that the different options are for different things, basically:

"NONE ... is often a good setting for animation or for large font sizes ..."
"PIXEL ... only works for left-justified text fields ... provides the best readability for left-aligned text."
"SUBPIXEL ... good setting for right-aligned or center-aligned dynamic text, and it is sometimes a useful tradeoff for animation vs. text quality .. etc"

Check out the tween example here. and the test mxml.

02/22/2008 12:39:35