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

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

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

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

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

Flash CS3 内嵌字体教程

本资料用于研究神秘视线6的汉化。
/ Q+ S4 O7 E$ O4 U- ]2 Z4 h) z( ^希望有热心的朋友把它翻译为中文。
, V# Y3 j/ j% H6 G( B: m1 w- b+ ?/ \3 r; @, q( w- l
原文
) i5 g- I+ v, B/ n' `http://livedocs.adobe.com/flash/ ... ;file=00000895.html1 y# x. q8 {5 k
; j( b, N2 a& O
Using TextField methods with embedded fonts9 U- |/ d0 f! C8 ]/ J
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. $ J8 K3 ?' g& I9 Q2 ?0 T7 {
0 o6 D- b6 ?4 T5 L* q9 y& Y* y
To set a text field's thickness using ActionScript:( s. @% u6 X! }+ ]/ a" [" w1 w
Create a new Flash document and save it as textfieldThickness.fla. 0 F( T" L  |- p( O+ z0 _5 j
Open the Library panel, and select New Font from the pop-up menu (in the upper-right corner of the Library panel). 3 s5 R0 D1 k7 y
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).
0 c3 S6 ?# n) g8 X- C7 @; p0 Z1 `+ t5 U6 {
Select the Times New Roman font from the Font drop-down menu.
; m8 F( }- ^" d6 n+ k* }Make sure that you deselect the Bold and Italic options. + D1 Y1 F1 g" ]. _4 j" U
Set the size to 30 pixels. ' m- h" Y7 w: }& b1 ^- O: c
Enter a font name of Times (embedded) 5 z* Y3 \  \7 k2 Q+ @! M3 t
Click OK. 9 i1 J( N% @4 `( A  z3 R
In the library, right-click the font symbol, and then select Linkage from the context menu. & F% J  ]$ A; V
Flash opens the Linkage Properties dialog box. ! y$ w& z; u4 F' Q* h5 P6 ?* A

, F5 E. F7 O) ^4 |; k+ f8 vSelect the Export for ActionScript and Export in first frame options and click OK.
3 l" A  H) R1 J2 CAdd the following ActionScript to Frame 1 of the Timeline:1 b2 I1 G1 G$ D, D4 x9 ]
// 1
. W2 _! C' l  S, Dthis.createTextField("thickness_txt", 10, 0, 0, Stage.width, 22);0 ]+ S( M- _; a
this.createTextField("lorem_txt", 20, 0, 20, Stage.width, 0);
& A, t' s9 B. Z1 B: m  F3 Ulorem_txt.autoSize = "left";9 \& y1 f. |2 B9 r& q
lorem_txt.embedFonts = true;
9 x9 J9 D6 o' \3 T( a  z0 n+ florem_txt.antiAliasType = "advanced";
: W0 W! y' s# g$ E( m  m+ elorem_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.";) p9 j& f$ \: I7 ]! T2 C' a
lorem_txt.wordWrap = true;
! N8 a* ~+ i# T/ E6 \8 R& R% h
" D' h4 C, v* k/ q' |6 A5 s) K5 `// 2
6 G* y/ v4 P: Rvar style_fmt:TextFormat = new TextFormat();; k' @, N, _7 N+ ?3 ~6 C
style_fmt.font = "Times (embedded)";
7 p5 ~, k! v* F( `# dstyle_fmt.size = 30;
3 q/ n# c: x/ U+ N4 l2 l/ d% vlorem_txt.setTextFormat(style_fmt);6 W! d8 t7 w6 t% k5 Y
9 V1 s( F- l/ h3 p6 i
// 3
% H0 F. Z- A2 g: Yvar mouseListener:Object = new Object();& o9 d8 [5 Q# q& z1 Y. R! }0 L' I4 `
mouseListener.onMouseMove = function():Void {- \3 s5 y2 I# n1 C
    // Values for TextField.thickness can range from -200 to +200.
& e9 C$ q# [' _4 Y    lorem_txt.thickness = Math.round(_xmouse * (400 / Stage.width) - 200);
: F; o9 s6 r' S, A! S    thickness_txt.text = "TextField.thickness = " + lorem_txt.thickness;  [/ _- K4 O5 z
};
4 G' y4 ]6 N! O# d2 ~Mouse.addListener(mouseListener);
* W" h! K8 m: F( Z+ l6 Y# H+ A6 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.
$ W/ O( ?! ~9 [5 U
( v# l" |" K/ s' K# V  GThe 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 [9 g/ E5 `4 A& ]9 C
+ S+ n/ r$ f8 i0 Q) oThe 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.  a+ E: l8 |2 U: q4 ~
) K1 P/ A+ O; C2 B( F) [6 g0 q3 ]
Save your changes to the FLA file.
# r9 r5 ?5 I; c1 tSelect Control > Test Movie to test your Flash document. & b- ^/ N1 Y: q$ ]
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日,是全球华人共同的冒险解谜类游戏家园。我们致力于提供各类冒险游戏资讯供大家学习交流。本站所有资源均不用于商业用途。

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