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.
I have swf font files downloaded from www.isarie.com
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.
if there are embedded fonts in library then i can access them u开发者_如何学Csing 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.
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/
精彩评论