Using AS3 I am dynamically creating, sizing, positioning and formatting a textfield. I am dynamically setting the content of the textfield from the contents of an xml file. I am trying to use the bold tag and noticed that it is not working. After a bit of searching the best I could come up with is "Flash CS4 tag in with htmlText". Bottom line: I have to embed an emboldened fontface.
As an example, let's say I want to use Tahoma. In my .fla file (using Flash CS4) I embed Tahoma and export it for use in actionscript. This lets me use Tahoma as a font in my textfield. If I try to use the b tag (textfield.htmlText="not bold, <b>bold</b>";
) the bold text does not get emboldened. Based on the above question I have now embedded the Bold version of Tahoma as well.
How do I link the bold version of Tahoma with the regular version of Tahoma so that when using the bold tag I get bold text in my textfield?
Based on @Marty Wallace's answer:
I have set up my textformat earlier in the code. It loads the font, size, etc.
What I am doing is applying the font to my text field, then setting the textformat bold attribute as true if the string contains a bold tag. Placing the code above the setTextFormat makes the entire textfield bold. For some reason setting it below the textfield makes just the tagged text bold.
textfield.setTextFormat(textformat);
if(xmlText.search('<b>')){
textformat.bold = true;
}
[edit]
Don't need the if:
textfield.setTextFormat(textformat);
textformat.bold = true;
[edit]
You also need the emboldened font embedded for this to work. I removed it from my library and couldn't get the bold to work again >.< In my tahoma example, the font name needs to be 'Tahoma bold'.
So now I need to embed the emboldened and italicised versions of all my fonts if I want to use <b> and <i> in my htmlText