【问题标题】:Is it possible to use `[Embed source=`... with Flash CS3?是否可以将 `[Embed source=`... 与 Flash CS3 一起使用?
【发布时间】:2011-03-21 08:43:36
【问题描述】:

是否可以使用 AS3 和 Flash CS3 IDE 执行以下操作?只有在 IDE 中创建了 txt TextField 并且删除了 txt.embedFonts 行时,以下操作才有效。如果我使用 AS3 而不是使用 IDE 创建 TextField,这将不起作用。通过代码嵌入字体是否仅在 Flex 中可用?

package mtm.EmbedFonts
{
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.AntiAliasType;
    import flash.text.TextFieldAutoSize;

    public class EmbedFonts extends MovieClip
    {
        public var txt:TextField; //References stage instance created in Flash CS3 IDE
        [Embed(source='C:/WINDOWS/Fonts/Arial.TTF', fontName='_Arial', unicodeRange='U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E')]
        protected var format:TextFormat = new TextFormat();

        public function EmbedFonts():void
        {   
            initTextFormat();
            initTextField();
            txt.text = 'Hello World!';
        }

        protected function initTextFormat():void
        {
            format.letterSpacing = 1;
            format.size = 14;
            format.font = "Arial";
        }

        protected function initTextField():void
        {
            txt.multiline = true;
            txt.wordWrap = true;
            txt.border = true;
            txt.selectable = true;
            txt.autoSize = TextFieldAutoSize.LEFT;
            txt.condenseWhite = true;
            txt.embedFonts = true;
            txt.setTextFormat(format);
            txt.antiAliasType = AntiAliasType.ADVANCED;
        }
    }
}

【问题讨论】:

    标签: flash actionscript-3 fonts embed


    【解决方案1】:

    遗憾的是,[Embed] 元标记仅在 Flex 中可用。

    【讨论】:

    • 修正;它仅在 Flex 编译器中可用。您可以使用该编译器发布非 Flex 项目,但 Flash IDE 使用单独的编译器。
    • 这很不幸。如果我对原因有更深入的了解,我会用除此之外的其他内容来回答:“跛脚”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-14
    • 1970-01-01
    • 2019-04-11
    • 2021-11-12
    • 2016-04-01
    • 2011-01-20
    相关资源
    最近更新 更多