开发者

Passing a font from one class to another

开发者 https://www.devze.com 2023-01-16 23:23 出处:网络
I loaded a font.swf (in Flash CS5)开发者_JAVA技巧 and it works in the class I loaded the font into, but if I want to pass it to another class, how do I do that?

I loaded a font.swf (in Flash CS5)开发者_JAVA技巧 and it works in the class I loaded the font into, but if I want to pass it to another class, how do I do that?

I tried passing it as a TextFormat instance (with the format.font = my_loaded_font) but that doesn't appear to work...


Once a font is embedded, you refer to it by its family name as a String. It need not be passed from class to class.


Fonts are global once loaded; you access them by their name in the global font list. See here:

http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/text/Font.html#enumerateFonts()

import flash.text.Font;

var allFonts:Array = Font.enumerateFonts(true);
0

精彩评论

暂无评论...
验证码 换一张
取 消