actionscript-3 – 嵌入式字体未出现在actionscript创建的文本字
我想在这篇文章的前言中说,我对此很新.我可能会遗漏一些明显的东西.
我正在使用Actionscript 3在Flash CS5中工作.我正在尝试使用actionscript创建一个文本字段,并用文本填充它.我使用“字体嵌入”窗口将我的字体嵌入到项目中.但是,当运行创建文本字段的代码时,如果“embedFont = true;”,则该字体是不可见的.当鼠标悬停在光标上时光标仍会改变,所以我知道它在那里.或者至少它的文本框是,我猜.已经在舞台上的嵌入文本的动态文本字段似乎不受影响. 我已经尝试更改嵌入字体大纲格式,但都不起作用.我尝试通过actionscript直接嵌入带有“embed”标签的字体,但它似乎不适用于CS5,或者我不知道我在做什么.正如您在提供的代码中看到的那样,我尝试过“注册”字体,但没有成功.我尝试过使用: var font:Font = new screenfont(); //"screenfont" is the name from Embedding Fonts var format:TextFormat = new TextFormat(); format.font = screenfont.fontName; 没有骰子. 我已经关注了一些关于嵌入的不同教程,并遇到了大量冲突,混乱的信息.我已经阅读了一些与此主题有关的不同帖子,但尚未找到任何可行的解决方案. 这是我的代码的简单版本,其中“screenfont”是我在Embedding Fonts窗口中指定的名称: Font.registerFont(screenfont); //TextFormat var listformat:TextFormat = new TextFormat(); listformat.align = TextFormatAlign.LEFT; listformat.size = 20.8; listformat.color = 0x0DAC54; listformat.font="Fixedsys Excelsior 3.01"; //TextField var photolist:TextField = new TextField(); photolist.x = photos_x; photolist.y = tempY; photolist.width = photos_wdth; photolist.height = photos_hght; photolist.text = photoname; photolist.embedFonts = true; //<--- This freakin' guy! photolist.antiAliasType = AntiAliasType.ADVANCED; photolist.defaultTextFormat=listformat; photolist.selectable = false; photolist.wordWrap = true; mediapage.photos.addChild(photolist); 我希望这能提供清晰的图景. 那么,如何在CS5中完成嵌入? 解决方法
您应该将文本设置为您做的最后一件事.所以这行photolist.text = photoname;应该追求一切.
var photolist:TextField = new TextField(); photolist.x = photos_x; photolist.y = tempY; photolist.width = photos_wdth; photolist.height = photos_hght; photolist.embedFonts = true; photolist.antiAliasType = AntiAliasType.ADVANCED; photolist.defaultTextFormat=listformat; photolist.selectable = false; photolist.wordWrap = true; photolist.text = photoname;//<-- set text only after applying all formatting and embedding mediapage.photos.addChild(photolist); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |