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

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

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

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

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

Flash CS3 内嵌字体教程

本资料用于研究神秘视线6的汉化。4 c4 c; D4 R$ A% E/ r' T/ N
希望有热心的朋友把它翻译为中文。
2 k+ N4 {7 Z& {3 t  G/ ^
, b- K3 ?1 X# {6 S/ C% o1 M原文
! c8 b* W6 x4 C! T: U3 n# qhttp://livedocs.adobe.com/flash/ ... ;file=00000895.html- _+ T1 x3 v0 o0 i" v
4 v  \0 L# S6 g  f: F, v4 P/ O/ J
Using TextField methods with embedded fonts
4 o9 v2 m* a9 Y0 a1 g. Y1 K, q" GMethods 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.
7 s, q. f) g% E0 b$ x" S% X/ w6 C* e! ^/ X
To set a text field's thickness using ActionScript:7 s" V* C( s/ S% W: }6 J. g$ @
Create a new Flash document and save it as textfieldThickness.fla. 1 P, w$ S$ J0 r# X1 [8 C: o
Open the Library panel, and select New Font from the pop-up menu (in the upper-right corner of the Library panel). : q9 G9 b0 X' @, w( L% r
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).
5 M$ _+ b/ I3 q4 S8 Z: B5 z  u) i; \2 O/ S7 R% Q& ~
Select the Times New Roman font from the Font drop-down menu. ! k( y* g5 |7 |8 r/ ~( V
Make sure that you deselect the Bold and Italic options. 1 ^$ v) {! V% i8 e( G; h6 ?
Set the size to 30 pixels. # A8 W- r  `% @! L
Enter a font name of Times (embedded) ) S7 [" |4 o4 Z! H4 F1 e
Click OK. ' I0 D' J" }  z
In the library, right-click the font symbol, and then select Linkage from the context menu. " V- f; D0 M' p9 C0 ~
Flash opens the Linkage Properties dialog box.
, U- T! x  V  O" l! z$ G1 t6 F  V- u) r( i9 t! c" T/ J
Select the Export for ActionScript and Export in first frame options and click OK. $ r+ k; V7 \! n! |4 B
Add the following ActionScript to Frame 1 of the Timeline:' \) j  i9 C4 w6 U; L
// 1
/ E) [4 }5 q! a' bthis.createTextField("thickness_txt", 10, 0, 0, Stage.width, 22);2 a" c( B7 N7 n/ j' k- Q
this.createTextField("lorem_txt", 20, 0, 20, Stage.width, 0);
! a' y2 o/ n+ k) k9 clorem_txt.autoSize = "left";
9 N0 B8 ]& m- U+ Blorem_txt.embedFonts = true;
/ f* V9 y( I% e: R- Ulorem_txt.antiAliasType = "advanced";$ ~& T9 H1 C0 q1 o: [1 p: y
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.";
' V; O( r. @4 F* @: ulorem_txt.wordWrap = true;
* o1 S3 S; ]5 n  U( i  F/ O$ q& Y" T& O6 U* r( ^9 U" D4 h+ m, g
// 2+ I1 z. g9 V# H; L
var style_fmt:TextFormat = new TextFormat();
/ |" N/ S5 h( ~+ a' n2 F0 Astyle_fmt.font = "Times (embedded)";
. z7 a0 X+ [, {9 M: J6 f: {style_fmt.size = 30;
; M5 N3 ?, q9 a4 c6 y) Mlorem_txt.setTextFormat(style_fmt);8 |$ \2 j' A+ Z% j. R
1 m' K+ l! b( {
// 32 y) K+ ?8 c6 r6 P' F; v+ |
var mouseListener:Object = new Object();, {1 D0 @6 ]" |+ k* q% L+ w
mouseListener.onMouseMove = function():Void {
* `% k! H" T) t4 R1 U    // Values for TextField.thickness can range from -200 to +200.
4 g' |5 U4 R$ F  b; b3 g% F+ w: i    lorem_txt.thickness = Math.round(_xmouse * (400 / Stage.width) - 200);9 j& E7 S& _4 e7 r7 _2 W$ c( a
    thickness_txt.text = "TextField.thickness = " + lorem_txt.thickness;
% u4 y# @- Q+ l( R2 W- y# R};% h+ j& V  p/ I
Mouse.addListener(mouseListener);1 z3 P8 g3 K+ h4 U7 a: ?7 {; y
The 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' K5 I, k- K. o
* q7 |. g! ]' b# |  [7 zThe 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./ V& ?# }+ }& c7 L" n

# X/ o/ P: c. }9 v! iThe 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.1 G  k( ], W1 Q8 H; V
" c" [% j" N- y  c. U( h
Save your changes to the FLA file. 7 R, k8 S; S( a  O" ~
Select Control > Test Movie to test your Flash document.
9 m" W3 o( y. ^2 [& w5 t+ |/ c6 @" [+ qWhen 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日,是全球华人共同的冒险解谜类游戏家园。我们致力于提供各类冒险游戏资讯供大家学习交流。本站所有资源均不用于商业用途。

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