更改AS3组件字体

时间:2010-01-14 19:45:14

标签: flash actionscript-3 components flash-cs4

我想通过Flash IDE(不在动作脚本中)更改组件的字体名称,字体大小和字符嵌入属性(在我的情况下为Combobox)。 有选择吗?

感谢。

2 个答案:

答案 0 :(得分:4)

不,您需要使用ActionScript来执行此操作。我是这样做的:

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);

        }

    }
}

答案 1 :(得分:-1)

看起来没有办法为默认flash组件设置外观字体。我最终写了自己的。

相关问题