AS3 Bold and Italic text in dynamic text fields
Dynamic text fields in Flash CS4 don’t show Bold or Italic text for some bizarre reason. I found this out when I tried to set the character style of a dynamic text field to Italics. When I exported the movie the Italic text did not appear. I try the Bold character style and that also did not appear.
I figured out you can get around this problem by using the TextFormat class.
Here is the code I used for the Italic text.
output_txt.text='hello ilike2flash'; var ItalicText:TextFormat = new TextFormat(); ItalicText.italic=true; output_txt.setTextFormat(ItalicText);
The code for the bold text is similar.
output_txt.text='hello ilike2flash'; var BoldText:TextFormat = new TextFormat(); BoldText.bold=true; output_txt.setTextFormat(BoldText);
Another solution is to use the Italic tags in the htmlText.
output_txt.htmlText = "<I>Hello</I>"If the Bold or Italic text still does not appear in the dynamic text field. You can try embedding the fonts.



1 comments:
Good one, both solutions worked.
Post a Comment