
The example above would also work if you didn’t call Font.registerFont(MyFontClass) before (when your font symbol is in the same fla / swf there’s no need to register it). So that seems to be the golden font rule #1:Īlways use the real font name (if you use an external css file use the real font name as the font-family)! Another solution is to instantiate the symbol directly and use its fontName property: myTextFormat.font = new MyFontClass().fontName. That’s bad if you want to switch your font in the library but don’t want to modify your code. If you set the font to “standard 07_57” in the properties dialog you have to write myTextFormat.font = “standard 07_57”. myTextFormat.font expects the real font name: Don’t confuse it with the class name in the export dialog). You can’t use myTextFormat.font = “MyFontClass” und you can’t use myTextFormat.font = “MyFontPropertyName” (“MyFontPropertyName” is the name that you set in the font symbols properties. The font property must be a String (the font name). One option for setting a font in a textfield is to create a new TextFormat() and set the font property.
#Working with flash cs3 code#
With that you successfully registered a font in the global list and can use it everywhere in your code now. What that means is that you can call Font.registerFont(MyFontClass) (MyFontClass is the class that you can set in the export dialog – name doesn’t matter) and then trace(Font.enumerateFonts()) and your font is listed… Unfortunately the help for registerFont (at least the German help) only says that it registers a font in the global font list and that it expects a parameter of type Class. The font class has a few properties (fontName, fontStyle and fontType) and two static methods which seem to be interesting:įont.enumerateFonts() and Font.registerFont(). The Font class in AS3 is an abstract class which means that it can’t be instantiated – so you can’t create a new one by calling new Font()… With fonts the class must extend the Font class and this is automatically set for you when you export the font:. in ActionScript 3.0) instead of a linkage id. The difference to Flash 8 is that you have to specify a class (same as with MovieClips, Bitmaps etc. you can create a font symbol in the library, give it a name, set the font, font size and variant and export it for ActionScript. In Flash CS3 there’s still the font symbol, i.e. Otherwise you don’t know if everything works and is really embedded. When you’re working with embedded fonts it’s important to always test your project on a different machine where they aren’t installed or disable them in some font managing tool.
#Working with flash cs3 generator#
For more information see the flash help ( Creating custom character sets) and Renzo’s Flash unicode table generator page. There’s a UnicodeTable.xml in the Adobe Flash CS3\(language)\First Run\FontEmbedding\ folder that you can copy and modify. You can define character sets in the Flash Authoring Tool (however you can’t set them via ActionScript!): You don’t have this option if compile with the Flash IDE… With Flex and mxmlc there’s the embed metatag where you can even define font character ranges which should be embedded. Trial and error…Īs the headline suggests this article deals with font embedding in Flash CS3 and not in Flex. After all articles about this topic I’ve read until now I have the feeling that nobody really understands what’s going on with fonts in different use cases. The good news is: It works – somehow – if you keep in mind some things. The bad news is: We have ActionScript 3.0 now and Flash CS3 and I still haven’t completely understood it yet. If I never really got something in Flash it was font embedding and runtime font loading. Home » Runtime font loading with AS3 / Flash CS3 (not Flex!) Runtime font loading with AS3 / Flash CS3 (not Flex!)
