本资料用于研究神秘视线6的汉化。
% a" M1 X* B9 d& q0 K6 p2 D' q* `希望有热心的朋友把它翻译为中文。
4 D5 S$ R ?+ v, `" A6 v; o0 w) d' _ I6 i- ]
原文
' w0 Y$ ` K0 c! k. Shttp://livedocs.adobe.com/flash/ ... ;file=00000895.html' ? p+ q) {7 N
5 k+ P, j( |/ G9 D: cUsing TextField methods with embedded fonts; Q3 `8 ?. D" D
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. 3 I+ j% B" ~; V4 n7 Z9 P% R
6 o+ I; o) k7 L; W% A8 y- [To set a text field's thickness using ActionScript:/ q* L& {" |5 o C0 @; {) ]
Create a new Flash document and save it as textfieldThickness.fla. 8 O0 G1 x3 I0 x" p6 D
Open the Library panel, and select New Font from the pop-up menu (in the upper-right corner of the Library panel).
8 b$ u* e1 F; sThe 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).- z4 U: }$ C% r0 ?; o! i
/ |; V5 V9 X M0 hSelect the Times New Roman font from the Font drop-down menu. 7 N6 |- B6 u: T' W& v
Make sure that you deselect the Bold and Italic options. 8 @: |. d' h4 I/ K" u* f1 B+ K0 z
Set the size to 30 pixels.
8 r F: n$ q, l8 i( _" [Enter a font name of Times (embedded)
! M# l/ H' f# p& W1 k1 [" T3 s% VClick OK.
4 k6 X9 H6 |5 |! G3 U8 h/ W7 h6 MIn the library, right-click the font symbol, and then select Linkage from the context menu.
$ X/ i& r4 `/ r: J+ [6 mFlash opens the Linkage Properties dialog box.
' w, A( o- M! W9 V- E* b
" Q u5 p! ~8 b3 ISelect the Export for ActionScript and Export in first frame options and click OK.
. S( d* B; i/ u8 {( A2 xAdd the following ActionScript to Frame 1 of the Timeline:. Q4 y8 Q. v4 _ q
// 1* O! v. _* R: R4 T9 e
this.createTextField("thickness_txt", 10, 0, 0, Stage.width, 22);6 a$ q+ |5 W2 X' a8 n }; p
this.createTextField("lorem_txt", 20, 0, 20, Stage.width, 0);- f* I9 Y: U# }2 h
lorem_txt.autoSize = "left";# o, }% a1 a. q
lorem_txt.embedFonts = true;
; k3 b, E; u# P- Hlorem_txt.antiAliasType = "advanced";9 U/ M0 B8 S# \- }3 b
lorem_txt.text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";, |7 y( o+ _+ g+ V7 O) N4 @
lorem_txt.wordWrap = true;# H% j6 }3 r' O, O8 @, c
Y% {! P0 L. M& d
// 2
5 q- c$ ]: A* j& Tvar style_fmt:TextFormat = new TextFormat();8 ]$ \2 [) f; y4 l
style_fmt.font = "Times (embedded)";( @3 W2 V; L- d7 ?
style_fmt.size = 30;% N e9 a; z% w7 C% @* x
lorem_txt.setTextFormat(style_fmt);/ o) |' Y3 |! q( K0 \) g: Y
8 _6 ]+ w8 v- N- s- b
// 3
2 ~ u9 _) S1 O2 J( p- y2 d }var mouseListener:Object = new Object();
$ Z6 ^8 N* ^2 m8 `0 e Z, CmouseListener.onMouseMove = function():Void {2 x% `( `. T8 {' R9 M0 \0 Q5 o
// Values for TextField.thickness can range from -200 to +200.& e6 j: }/ n1 k$ l4 n$ P
lorem_txt.thickness = Math.round(_xmouse * (400 / Stage.width) - 200);$ U9 u# |$ G0 k$ U+ k" a
thickness_txt.text = "TextField.thickness = " + lorem_txt.thickness;
* ~5 y% l* W! {- t+ R! o};+ n* U6 U9 r2 b, D/ {6 }0 n- d3 ^
Mouse.addListener(mouseListener);
4 F6 ~# l1 x7 R/ {# r/ gThe first block of code creates two text fields, thickness_txt and lorem_txt, and positions them on the Stage. The lorem_txt text field sets its embedFonts property to true and populates the text field with a block of text.
p. P0 G9 A' T- m
" @' c) J5 M5 i; f. ~9 @4 v8 V" KThe second block of code defines a text format with the font face Times New Roman, sets the font size to 30 pixels, and applies the text format to the lorem_txt text field.% U1 c8 B7 X' X3 `
3 J- h& r) O! u- L- u& u8 L
The third, and final, block of code defines and assigns a mouse listener for the onMouseMove event. When the mouse pointer moves horizontally across the Stage, the TextField.thickness property changes between -200 and +200, depending on the current value of _xmouse.
' z- \0 Z/ e! F3 ?& T
7 H! p. v2 M3 N6 b( b4 N. dSave your changes to the FLA file. $ z' h# X3 P* ^! p1 g
Select Control > Test Movie to test your Flash document.
( O8 B8 E$ ~+ A' O2 S" N! n2 iWhen you move the mouse pointer to the left half of the Stage, the font thickness decreases. When you move the mouse pointer to the right half of the Stage, the font thickness increases. |