textarea component’s textformat style is case sensitive – sometimes

This one cost me a few hairs, so I’m jotting it down in case it can save someone else some time (like me, down the line).

In a TextFormat object, verdana is not the same as Verdana. Duh! But the flash stand alone player might make you think it is…

I’m working with a couple CS 3 textarea components, adding them to stage from code (AS 3), and updating the text at runtime (fed from an XML file).

Using the CS 3 compiler, and therefore the stand alone player to view the compiled swf, all looked fine. So far so good. But when looking at the swf embedded in an html page, all of a sudden all the fonts were off. The TextFormat’s font was not sticking. Search, scratch, search, argh.

It didn’t seem to make sense that the stand alone player was displaying the font as desired, but the plug-in player didn’t pick up the style.

It was a stupid spelling error: myTextFormat.font = "verdana" ;
The stand alone player didn’t care, somehow it figured it out. The plug-in player didn’t like it though, and reverted to a default text style.
The fix: myTextFormat.font = "Verdana" ;

Like I said. Duh! Lunchtime, finally.

Advertisements
This entry was posted in flash, actionscript, flex and tagged , . Bookmark the permalink.