Изменить шрифт компонента AS3 - PullRequest
0 голосов
/ 14 января 2010

Я хочу изменить имя шрифта, размер шрифта и свойства встраивания символов компонента (Combobox в моем случае) через Flash IDE (не в сценарии действия). Есть ли возможность сделать это?

Спасибо.

Ответы [ 2 ]

4 голосов
/ 15 января 2010

Нет, вам нужно использовать 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);

        }

    }
}
0 голосов
/ 23 октября 2010

Похоже, что нет способа скинуть шрифт компонентов флэш-памяти по умолчанию. В итоге я написал свой собственный.

...