设为首页收藏本站官方微博

汉化资料 Flash CS3 内嵌字体教程

[复制链接]
查看: 1801|回复: 0
打印 上一主题 下一主题

[汉化资料] Flash CS3 内嵌字体教程

跳转到指定楼层
楼主
发表于 2010-1-22 11:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

Flash CS3 内嵌字体教程

本资料用于研究神秘视线6的汉化。
) H4 L3 Q; n4 `$ W希望有热心的朋友把它翻译为中文。
! l( K3 I/ U' N5 R/ X0 i
2 M3 ^& K, I/ I% W( f原文
. l1 Q* M8 O. Q- y9 @http://livedocs.adobe.com/flash/ ... ;file=00000895.html! ^& Y- e( a0 K

$ E7 q* O& E# ~0 H8 G$ x& _Using TextField methods with embedded fonts
* k8 l! A& |6 ~1 |. D: l5 rMethods 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. ! ?; a4 T2 U, E: A6 N9 N; [2 a
8 @7 p: B. y8 K  `
To set a text field's thickness using ActionScript:; h& B) L8 A( B& y
Create a new Flash document and save it as textfieldThickness.fla. , C: j+ D+ A- V% V( @/ O0 t* ^
Open the Library panel, and select New Font from the pop-up menu (in the upper-right corner of the Library panel).
8 y- Y2 _. H3 g2 p4 F; g5 QThe 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).. ?. R- v% `( ], H) ^7 r
8 D. y4 f: j3 _4 o* G) ~
Select the Times New Roman font from the Font drop-down menu. - f! t( a1 [2 w! M6 l7 {
Make sure that you deselect the Bold and Italic options.
: @/ F% C! z! a  f6 BSet the size to 30 pixels. % N7 A, W( Z3 k8 Z" f' Y
Enter a font name of Times (embedded) & }2 l6 j! ^6 P* E
Click OK.
4 {. }( w6 i. ?4 j! J1 _4 `' AIn the library, right-click the font symbol, and then select Linkage from the context menu.   b7 r' B$ \% G* G; H" F
Flash opens the Linkage Properties dialog box. + L0 Q+ u/ E% ^6 i

# G2 O8 I8 V" R/ n) @2 n; @; K* I' lSelect the Export for ActionScript and Export in first frame options and click OK.
. c; ~! h4 m2 [. B+ r- tAdd the following ActionScript to Frame 1 of the Timeline:
* x) I. l+ f. N+ t6 C1 s// 1
+ Q) B: t/ n. x( ?- jthis.createTextField("thickness_txt", 10, 0, 0, Stage.width, 22);" M+ g8 i6 T  ?
this.createTextField("lorem_txt", 20, 0, 20, Stage.width, 0);
1 x9 z! L8 l9 H& g& Tlorem_txt.autoSize = "left";% z9 }5 Y$ j4 ^( j+ L. I& |% F
lorem_txt.embedFonts = true;0 v* V$ m3 a* V& }
lorem_txt.antiAliasType = "advanced";0 D3 J- g4 C8 c/ R$ O* n( O
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.";$ _  s3 j* i1 [$ k1 t4 T+ q2 k
lorem_txt.wordWrap = true;
6 }! I4 f; E# _$ y! x+ ]5 O7 p
6 L: o6 U  @* U2 I  }// 2
7 _, B/ s" f' ?, A6 ^/ ]var style_fmt:TextFormat = new TextFormat();% O6 Y2 m, e+ B1 B4 l$ c9 B
style_fmt.font = "Times (embedded)";
3 g+ X9 g/ N! X/ Z" qstyle_fmt.size = 30;% ~& ?7 d; H( A% f% c5 n
lorem_txt.setTextFormat(style_fmt);
1 U* o, ~1 M. k. o) G
6 l6 I8 I: n& i0 b7 P6 O/ v// 35 ]9 r) W4 F/ J
var mouseListener:Object = new Object();
) k3 _" G/ k. PmouseListener.onMouseMove = function():Void {8 [8 u/ P' F0 ^) O8 M
    // Values for TextField.thickness can range from -200 to +200.4 r  Q2 c  K% Z0 V+ r3 U8 B" D
    lorem_txt.thickness = Math.round(_xmouse * (400 / Stage.width) - 200);* r7 J, F" o' D" Q
    thickness_txt.text = "TextField.thickness = " + lorem_txt.thickness;+ y2 A6 v7 Q+ \/ e- @$ X9 G
};
  `8 D3 k. A( j1 J. a$ l* p7 j  P; }- wMouse.addListener(mouseListener);
6 Z3 D5 J0 H" ^8 e5 O2 ]3 X+ zThe 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.
+ L2 @2 l- X; A5 b# I8 V  c$ M/ S, \
The 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.
+ @8 l2 _9 l4 x8 I" N  w
- B9 J+ X4 |4 D. ]- H% j" \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.
2 p. d. F5 m0 M# Q5 L5 R  @. N/ C4 A: B; M# U$ F' U0 N; l1 m
Save your changes to the FLA file.
; z) f2 t7 A7 ~! Y* D( T: ZSelect Control > Test Movie to test your Flash document.
+ }3 e0 F6 P7 v9 ?When 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.
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 很美好很美好 很差劲很差劲
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

冒险解谜游戏中文网 ChinaAVG

官方微博官方微信号小黑屋 微信玩家群  

(C) ChinaAVG 2004 - 2019 All Right Reserved. Powered by Discuz! X3.2
辽ICP备11008827号 | 桂公网安备 45010702000051号

冒险,与你同在。 冒险解谜游戏中文网ChinaAVG诞生于2004年9月9日,是全球华人共同的冒险解谜类游戏家园。我们致力于提供各类冒险游戏资讯供大家学习交流。本站所有资源均不用于商业用途。

快速回复 返回顶部 返回列表