404
Working with Text and Strings
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.
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)
TIP
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.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...