Wacky Flash quick tip #127:
A co-worker of mine recently asked me how to get italics to appear in a Flash html Text Field. Use the i tag I told him but he said he tried that and the text disappeared altogether. Assuming he was deranged I quickly opened a new Flash document and attempted to demonstrate what I was talking about.
I created a dynamic text field, marked it as html, embedded my font, gave it an instance name, wrote a little AS to populate it and hit CTRL-ENTER. To my surprise, there was no text on the stage. After retracing my steps to make sure I didn’t miss anything I tried again to make sure. Nope, still not working. It ended up taking me about 20 minutes to figure out.
Here’s the trick:
You have to place a dynamic text field on the stage for each style of the font you want to use. For example, the string I’m using to populate the field is “hello there”, so I had to place one dynamic text field with the italic font style embedded and another embedded with no style. Once that was done it worked perfectly.
I thought the whole process was pretty bizarre which is why I’m posting it. If it doesn’t benefit anyone else at least it’ll be here for my own personal reference 😉 .
If you’re interested, here’s a .fla to demonstrate.