- Characters missing from text in Flash CS4 file when opened in Flash CS5
- Flash CS5 font embedding – it’s totally different…
To summarize, add a font to your project/ FLA file, click on Text ==> Font Embedding, and add the font-family you are using in your project. Say you want to "Myriad Pro" to your project, add the family and style you wish you use in your project as shown in the image below.
[caption id="attachment_75" align="alignnone" width="300" caption="Fig. 1"]
You will need to add all the styles you want to use in your project individually. If you plan to use the font in dynamically created objects, then you need to export it for AS3 as well. Click on the "ActionScript" tab and provide the class name for the selected style.
[caption id="attachment_76" align="alignnone" width="300" caption="Fig. 2"]
My project is all in AS3, so I also needed to register the fonts and for that the syntax is same as before.
Font.registerFont(FONT_MYRIAD_PRO);
Font.registerFont(FONT_MYRIAD_PRO_I);
Font.registerFont(FONT_MYRIAD_PRO_SB);
Font.registerFont(FONT_MYRIAD_PRO_SB_I);
Font.registerFont(FONT_MYRIAD_PRO_B);
Font.registerFont(FONT_HELVETICA_NEUE);
Second change when compared to the earlier method is that while earlier one had to use the font name set in the code used to emb the font, now we use the standard name of the font.
If you are using TextFormat, it will be like :
mouseoverTF = new TextFormat();
mouseoverTF.align = TextFormatAlign.LEFT;
mouseoverTF.font = "Myriad Pro";
mouseoverTF.bold = true;
mouseoverTF.color = 0xFFFFFF;
mouseoverTF.size = 13;
and if you are using StyleSheet, then
var _defStyle:String = " .btext { font-family: Myriad Pro; font-size: 13;font-weight: bold; color: #333333; }";
Any ideas on how to uncheck "Export in Frame 1" and still get things to work? One of the nice things about the old [Embed(source)] mess was that fonts could be loaded JIT within a class that required them. I'd prefer not to bloat preload times by having a vast quantity of bytes up front from fonts...
ReplyDeleteWell, AFAIK you will have to export the class if you want to use it in your AS3 code. And though I have not checked it myself but looks like you can delay the exporting of classes to some other frame instead of the first frame to some other frame by going to "Publish Settings" ==> "Flash" ==> "Script Settings" and on that screen change the value for the field "Export classes in frame". You can see more on this here and here. The adobe documentation is for CS3 and talks about AS2, but as I see these option available in CS5 as well, am guessing that it may work for you.
ReplyDeleteand there is one more here
ReplyDelete