Here’s the concept:
In a file that’s publishing to Flash 9, create a textfield, give it an instance name of “tf1″, set the font to comic sans, and make it dynamic.
In the actionscript, do the following:
tf1.text = "this text is normal";
tf1.rotation = 30;
when you compile, you should get an error like
Fonts should be embedded for any text that may be edited at runtime, other than text with the "Use Device Fonts" setting. Use the Text > Font Embedding command to embed fonts.
This is solved by embedding the fonts, but when you’ve got one font with multiple states, things get a little weird.
Duplicate your textfield and set the instance name to tf2
Set the font to comic sans bold
Click the Embed button. Comic Sans Bold will be added. Choose the typical settings for embedding, Upper, Lower, Numbers, Punctuation and hit ok.
Click your other textfield and hit Embed. The second font, Comic Sans Regular will be added. Choose the typical settings for embedding, Upper, Lower, Numbers, Punctuation and hit ok.
Set your actionscript to
tf1.text = "this text is normal";
tf1.rotation = 30;
tf2.text = "this text is bold";
tf2.rotation = 30;
An odd thing happens. Whichever font we embedded first seems to be the only one that’s used. This is fixed in one of two ways:
Okay way:
Use htmlText with italic and bold indicators to produce the effect you want.
tf1.text = "this text is normal";
tf1.rotation = 30;
tf2.htmlText = "<b>this text is bold</b>";
tf2.rotation = 30;
Better way:
use getTextFormat and setTextFormat
var format:TextFormat = tf1.getTextFormat();
tf1.text = "this text is normal";
tf1.setTextFormat(format);
tf1.rotation = 30;
format = tf2.getTextFormat();
tf2.text = "this text is bold";
tf2.setTextFormat(format);
tf2.rotation = 30;
this can also be done more dynamically using functions:
function setText(txt, val)
{
var format:TextFormat = txt.getTextFormat();
txt.text = val;
txt.setTextFormat(format);
}
setText(tf1, "this text is normal");
setText(tf2, "this text is bold");
tf1.rotation=30;
tf2.rotation=30;
cs5_font_embedding.fla