AS3:嵌入字符

编程入门 行业动态 更新时间:2024-10-18 10:19:13
本文介绍了AS3:嵌入字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我具有文本字段和卡拉科特嵌入了一些麻烦。正如我已经明白,嵌入字符在Flash的方式,是有在导出通过一些类名来动作一个影片剪辑一个文本字段。然后让文本字段嵌入的字符。

但是,当我尝试使用文本字段在我的项目,我无法自动调整的领域不再!?有没有更好的方式来嵌入本地字符?还是我失去了一些未知属性? (是的,我已经试过 TextField.autoSize =左(或中心或右))。

该文本字段配置这样在Flash CS4: 属性: screencast/t/0VB6KnNO6G 图书馆实现: screencast/t/w3yQLqit0veI

和我嵌入包含文本字段像这样的影片剪辑:

保护VAR TABNAME:影片剪辑=新文本(); //该对象的属性

添加文本并设置其设置:

VAR TXT:文本字段= tabname.txt;         如果(!包含(TABNAME))         {             的addChild(TABNAME);             VAR格式:的TextFormat =新的TextFormat();                 format.bold = TRUE;                 format.font =宋体;                 format.size = 12;                 format.align =左;             VAR阴影效果=新的DropShadowFilter(0);                 dropShadow.color = 0XFFFFFF;                 dropShadow.strength = 2;                 dropShadow.blurX = dropShadow.blurY = 5;                 dropShadow.alpha = 0.7;             txt.type = TextFieldType.DYNAMIC;             txt.multiline = tabname.wordWrap = FALSE;             txt.autoSize = TextFieldAutoSize.LEFT;             txt.defaultTextFormat =格式;             txt.filters = [阴影效果]             txt.mouseEnabled = FALSE;             txt.x = 10;         }         txt.text =价值;         txt.y = Math.ceil((tabmask.height - txt.height)/ 2);

解决方案

要嵌入字体,不依赖于它们包裹在图书馆影片剪辑。他们应该被正确嵌入字体。我已经包括下面的一些基本步骤嵌入字体,那么你的特殊情况的一个例子:

1 - 使文本框的动态,并点击嵌入..按钮

2 - 名有意义的事(如字体名称)的字体,并勾选您将使用(一般我选择帽子,小写字母,数字和标点符号)的字符集。还要注意的风格是'大胆',你将需要嵌入各个风格的字体集。所以,如果你想使用粗体和正,你需要嵌入字体2

3 - 如果您打算通过ActionScript动态添加文本框,后藤的动作选项卡,并添加一个类为它(再次,使用有意义的名称)

4 - 最后点击确定,并远离你去。我已经安装的例子,使用这些步骤,并自动调整大小的方法,你可以看到下面

结果

I having some trouble with TextFields and caracter embedding. As I have understood, the way to embed character in Flash, is to have a TextField in a movieclip that is exported to actionscript via some classname. Then have the TextField embed the characters.

But when i try to use that TextField in my project, I cannot auto resize the field any longer!? Is there a better way to embed charactes? or am I missing some unknow attribute? (and yes i have tried TextField.autoSize = "left" (or "center" or "right")).

The TextField is configured like this in Flash CS4: Properties: screencast/t/0VB6KnNO6G Library implementation: screencast/t/w3yQLqit0veI

And I embed the MovieClip containing the TextField like this:

protected var tabname:MovieClip = new Text(); // The property on the object

Adding the text and setting its Settings:

var txt:TextField = tabname.txt; if( !contains(tabname) ) { addChild(tabname); var format:TextFormat = new TextFormat(); format.bold = true; format.font = "Arial"; format.size = 12; format.align = "left"; var dropShadow = new DropShadowFilter(0); dropShadow.color = 0xFFFFFF; dropShadow.strength = 2; dropShadow.blurX = dropShadow.blurY = 5; dropShadow.alpha = .7; txt.type = TextFieldType.DYNAMIC; txt.multiline = tabname.wordWrap = false; txt.autoSize = TextFieldAutoSize.LEFT; txt.defaultTextFormat = format; txt.filters = [dropShadow]; txt.mouseEnabled = false; txt.x = 10; } txt.text = value; txt.y = Math.ceil((tabmask.height - txt.height) /2);

解决方案

To embed fonts, don't rely on wrapping them in MovieClips in the library. They should be embedded correctly as Fonts. I have included some basic steps below for embedding fonts, then an example for your particular situation:

1 - Make the textfield Dynamic and click the Embed.. button

2 - Name the font with something meaningful (like the fonts name) and tick the character sets you will be using (usually I select caps, lowercase, numbers and punctuation). Also note the Style is 'Bold', you will need to embed a font set for each style. So if you want to use Bold and Regular, you need to embed 2 fonts.

3 - If you plan on adding textfields dynamically through ActionScript, goto the ActionScript tab and add a class for it (again, use a meaningful name)

4 - Finally click ok, and away you go. I have setup an example, using these steps, and the auto size method, you can see the results below

更多推荐

AS3:嵌入字符

本文发布于:2023-11-23 16:05:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622068.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!