AS3:嵌入字符 [英] AS3: Embedding characters
问题描述
我具有文本字段和卡拉科特嵌入了一些麻烦。正如我已经明白,嵌入字符在Flash的方式,是有在导出通过一些类名来动作一个影片剪辑一个文本字段。然后让文本字段嵌入的字符。
但是,当我尝试使用文本字段在我的项目,我无法自动调整的领域不再!?有没有更好的方式来嵌入本地字符?还是我失去了一些未知属性? (是的,我已经试过 TextField.autoSize =左(或中心或右)
)。
该文本字段配置这样在Flash CS4:
属性:
http://screencast.com/t/0VB6KnNO6G
图书馆实现:
http://screencast.com/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:
http://screencast.com/t/0VB6KnNO6G
Library implementation:
http://screencast.com/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:嵌入字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!