简体   繁体   English

更改AS3组件字体

[英]Change AS3 Component Font

I want to change font name, font size and character embedding properties of a component (Combobox in my case) through Flash IDE (not in action script). 我想通过Flash IDE(不在动作脚本中)更改组件的字体名称,字体大小和字符嵌入属性(在我的情况下为组合框)。 Is there an option to do that? 有没有这样做的选择?

Thanks. 谢谢。

No, you need to use ActionScript to do that. 不,您需要使用ActionScript来做到这一点。 Here is how I do it: 这是我的方法:

package com.twoa.ui.base.controls {
    import fl.controls.ComboBox;
    import fl.controls.List;
    import flash.text.Font;
    import flash.text.TextFormat;

    public class MyComboBox extends ComboBox {

        private var textFormat:TextFormat;
        private var textFormat2:TextFormat;

        public function MyComboBox() {
            super();
            forceStyle();
        }

        public function forceStyle() {

            var f:Font = new Interface();

            var textFormat:TextFormat = new TextFormat()
            textFormat.size = 8;
            textFormat.color = 0xffffff;
            textFormat.font = f.fontName

            var textFormat2:TextFormat = new TextFormat()
            textFormat2.size = 8;
            textFormat2.color = 0xffffff;
            textFormat2.font = f.fontName

            dropdown.setRendererStyle("embedFonts", true);
            dropdown.setRendererStyle("textFormat", textFormat);

            textField.setStyle("embedFonts", true);
            textField.setStyle("textFormat", textFormat2);

        }

    }
}

It looks that there is no way to skin font of default flash components. 看起来没有办法设置默认Flash组件的外观字体。 I ended up writing my own. 我最终写了我自己的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM