简体   繁体   English

使用外部字体Swf更改AS3中动态文本字段的字体

[英]Use external Font Swf to change font of a dynamic text Field in AS3

I am working on a as3 project in which the user select a font from Combo Box and that font SWF should be loaded Dynamically and then i need to change the font of the Dynamic text field. 我正在一个as3项目中,在该项目中,用户从组合框中选择一种字体,并且该字体SWF应该动态加载,然后我需要更改动态文本字段的字体。

I have swf font files downloaded from www.isarie.com 我有从www.isarie.com下载的swf字体文件

My question is that how can i load the font swf dynamically from server and add them to the library and how can i use that swf to change the font of dynamic text field. 我的问题是如何从服务器动态加载字体swf并将其添加到库中,以及如何使用该swf更改动态文本字段的字体。

if there are embedded fonts in library then i can access them using this- 如果库中有嵌入字体,那么我可以使用此字体访问它们-

var fontList:Array = Font.enumerateFonts();
for( var i:int=0; i<fontList.length; i++ ){
    trace( "font: " + fontList[ i ].fontName );
} 

But How to use dynamically loaded Font swf as a font type. 但是如何使用动态加载的Font swf作为字体类型。

If you know font class name, so: 如果您知道字体类名称,那么:

 var fontClass:Class = swfLoader.contentLoaderInfo.applicationDomain.getDefinition("FontClassName") as Class;
    Font.registerFont(fontClass);

otherwise you can use FontLoader class by Denis Kolyako, you can get it here: http://etcs.ru/pre/FontLoaderDemo/ 否则,您可以使用Denis Kolyako的FontLoader类,可以在这里获取它: http ://etcs.ru/pre/FontLoaderDemo/

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

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