5.
Add a new TextField instance on the Stage by using the Text tool.
6.
Set the Text type of the TextField to Dynamic in the Property inspector, and then click
Embed Character Options to open the Character Embedding dialog box.
7.
Scroll to the bottom of the Character Embedding dialog box and select your new custom
character set, Uppercase and Numerals [A..Z,0..9] (38 glyphs).
8.
Select any other character sets and click OK.
If you select your custom character set, Uppercase and Numerals [A..Z,0..9], as well as the
default Uppercase [A..Z] or Numerals [0..9] character set, notice that the number of
glyphs that are embedded doesn't change. This is because all of the uppercase characters
are included in your custom character set, and Flash doesn't include duplicate characters,
which keeps the file size as small as possible. If you select the Punctuation character set,
which includes 52 glyphs, as well as your custom character set, which includes 38 glyphs,
Flash stores information for only 88 glyphs instead of 90. This happens because two
overlapping characters, the space and the period, are already included in your custom
character set.
The position of a character set in the Character Embedding dialog box is determined
by its location in the XML document. You can reorder the character sets, including
your custom character sets, by moving <glyphRange> packets in the XML file.
Using TextField methods with embedded fonts
Methods of the TextField class provide useful functionality for your applications. For example,
you can control the thickness of a text field by using ActionScript as demonstrated in the
following example.
To set a text field's thickness using ActionScript:
1.
Create a new Flash document and save it as textfieldThickness.fla.
2.
Open the Library panel, and select New Font from the pop-up menu (in the upper-right
corner of the Library panel).
The Font Symbol Properties dialog box opens. This dialog box lets you select a font to
embed in the SWF file (including a font style and font size). You can also assign a font
name that appears in the document's library and the font drop-down menu in the
Property inspector (if you have a text field selected on the Stage).
a.
Select the Times New Roman font from the Font drop-down menu.
b.
Make sure that you deselect the Bold and Italic options.
c.
Set the size to 30 pixels.
d.
Enter a font name of Times (embedded)
404
Working with Text and Strings
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?