Embedding Fonts in Flash CS4
We’ve been often asked how we embed fonts in out Flash Components, so we’ll do a simple step by step tutorial for Flash CS4 (AS3). We are using a MAC, but the same applies for Windows.
Step 1
Right click on the library and select New Font.

Step 2
After clicking the New Font item, the Font Symbol Properties window appears.

Select the font and the style, give the font a name and a size, and check Export for ActionScript.

Step 3
Create a Dynamic Text Field and give the instance a name. (we used the name txt)
Select the text field and the font you just created.
NOTE: If you embedded the font correctly, a * should appear at the right of the font name in the fonts list, and all embedded fonts are positioned at the top of the list, exactly as in the image below.

Step 4
The last step is to add the ActionScript code in your .as file or in the timeline. In this example we’ll add it in the timeline, although all our Flabell Flash Components use Classes. :)
// AUTO SIZE txt.autoSize = TextFieldAutoSize.LEFT; // SCROLLABLE txt.selectable = false; // MOUSE ENABLED txt.mouseEnabled = true; // HTML text txt.htmlText = "Flabell - New Flash Components Every Week!";
The code should be self-explanatory. You can download the source files here: Flabell – embedding_fonts_in_CS4.
This post has 67 comments | Post your comment
Do your products take infos from fonts’ file? If I change name of font and leave a name of Turkish font, do application work?
Does this work for AS3? It’s asking me to change my AS to 1.0 or 2.0. Can you explain how to do it for AS3? Thanks very much.
You say this is for AS3 but Flylet is right: Flash CS4 will not let you do this without either changing to AS1 or AS2 or giving a ClassName instead of an identifier.
But if you give a ClassName you have to create a class for the font, and I can’t find info on what properties and/or methods that class needs.
Can you give us an idea how to do this in AS3?
You said “this is for AS3. ;)”
Actionscript 3 replaced using identifiers with Class names.
This tutorial uses actionscript 2.0 or lower.
Hi … First, thank you Andrei for doing this. Youre doing us all a HUGE favor by sharing your knowledge.
Ive uploaded a screenshot of the Font Symbols Properties window here…. http://www.eliteeventscompany.com/images/no_id.jpg … so you can see what Im seeing.
Can you help?? ~Angel
Oh, I forgot to mention that I tried this with other fonts as well, and I get the same problem… no Identifier field available.
This works slightly for me in CS4 (my text no longer vanishes) however it still wont display a bold version of my font.
I have imported both bold and regular versions of a font, the display as expected in the authoring environment, (and preview of the font) but on publish both appear as regular.
This is slightly better than the text vanishing but still dosn’t give me bold.
For bold text, you need to do the same thing, but make sure you give the font a different name, and select the bold property.
Like.. ArialBold for example. Same goes for italic.
I have the same problem as Matt. I did it all but bold doesn’t show in my htmlText. If all the field is bold I see it, so I think bold’s embed. But if my html has a tag, everything’s regular. Any ideas?
Thank’s in advanced.
I work, loading swf files into my main flash, to incorporate the font, in all, it is cleared when I load a new swf, which has the same font!
why this happens?
what is the correct way to work with font in several SWF files?
I’m creating a symbol and exporting to other swf!
I’d sweetie to be aware that too!
Thank you bobocel for the post!
It was straight forward and exactly what I needed…you are a gentleman and a scholar.
You only need to embed fonts for dynamic and input fields for Flash CS4 / Actionscript 3.0 right?
Hi i’m trying to follow this Tutorial but the problem is that I can’t name the identifier since Flash won’t let me.
Why not? How did you do it?
I have Flash cs4 and a document AS3.
Hope to hear from you soon.
regards,
Roy
I got more and more complicated with the fonts, I used khmer Unicode (http://www.khmeros.info) at the begining it’s ok but when i try to get from xml and show in the list nothing character.
In Flash Mp3 Player, I write unicode xml file by vietnamese but it could not display. Do I have to change font in source flash? Or anyway to resolve this problem?
Please help.
Hi Ken, I have succeeded in implementing displaying Vietnamese in uft-8 coded XML. You have to embed Verdana font in every text field from the source file then export the new player. So follow the above for embedding the new font then go to library of source and embed text field with Verdana font one by one. Hope this can help you
Regards
Hi Hoai Nhan,
I did but it’s happened some errors. Can you send me your email with your changed flash that I check it?
My email: [email protected], admin cakhucvietnam.com. Thanks for your help.
Hi Ken,
I just sent it to ur gmail account. Look at my homepage: http://www.lotusmedia.net to see how I have implemented
I am using Flash CS4 (AS3.0) on Windows. The “Identifier” field is disabled, only “Class” and “Base Class” fields are enabled. If i specify the “Class” the text is not displayed any longer. What’s wrong?
well i tried to follow it precisely, but as Scott wrote, using AS3.0 i cannot specify the “Identifier” for linkage as described in the example as the field is disabled. Only “Class” and “Base Class” fields can be edited. If I use the “Class” field to specify the id, then it’s not going to work, i.e. no text is displayed by banner rotator.
This is a wonderful post. Thanks so much. My embedded font text was visible when the SWF was viewed on a Mac, but on Windows, it disappeared. (This might have been a Flash Player version issue — I don’t know.) Luckily I had read your post here, and it solved the problem.
Note that my problem concerned a dynamic text field ON THE TIMELINE — I had embedded the font in the old way (using only the Properties panel). The ActionScript in the SWF is changing the text when a button is clicked.
So even though I was not using a Flash Component, I had to use the technique you have documented here.
This works good if I am putting the text field on the stage manually but what if I am building the text field in a class file? Say I created my own button and inside the button is a label and I want to use this method to format the text inside that button class.
How would I go about doing that?
I think you should do more posts like this. Help is appreciated.
Adding to my bookmarks! An explanation is appreciated.
I`ve a problem with the fonts, too. Ihave on my mac 1100 fonts they are all shown in PS but just 200 are shown in Flash cs4 and cs5 how can I resolve the Problem?
Anybody an Idea?
Hello. I had same problem: bold dynamic text changed back to regular one. I embedded both of them, i attached them to right text and i saw them in my flash generate report. When I put them directly without change the text of dynamic text it worked, but when i changed the text, it didn’t. Someone could tell me where I missed?
Thank you so much before.
I have found a way to correct it. So, it looks like that although way that you mentioned works well on CS3, it doesn’t on CS4. For CS4, you need to embed bold font, and instead of using .text, use .htmlText and “your text here ” to produce bold text.
Thank you.
Thanks for this. It works perfectly. I think what I and possibly some others here need to know how to dynamically create the text field itself. With your tut the textfield is crated in the timeline and stored in the library – what if one needed to create 1000 of these?
Do you have the code to dynamically create the textfield?
Many thanks.
When I click on identifier for the new font, it gives me a message “this action is not supported by Actionscript 3.0. To use this feature , you must target ActionScript 2.0-1.0
September 30, 2010 at 12:31 pm
[...] need to embed if it's not a default font… Best to embed anyway, looks nicer on all PCs that way. Embedding Fonts in Flash CS4 – Flabell blog if you're on CS4 __________________ [...]
Hi there.
I am trying to embed the unicode to display Greek characters.
Steps I followed so far:
- Opened all XML files and saved them as utf
- Opened the .fla file and replaced the fonts in the library with Arial Greek font type.
- Changed the XML text into Greek chars.
When I test the .swf , instead of Greek I just get a blank text.
Any help??? I would really appreciate it..
ps. the poll is magnificent!!!!
something I forgot to mention.. I used Flash CS3 Pro
I have a similar problem as fosforo.
I have a DynamicText field which I dynamically set the content of at runtime via .htmlText.
I am able to embed a font and have that be used by the field, but if the content for the field includes HTML bold or italic tags then that part of the text simply does not appear.
Is there a way to do what I need?
i made all the steps and i received only these “δ α” instead of “δα” i wrote, i embed a greek font but i receive the full name of the letter
ty very much
i received & d e l ta; &al pha ;
hello to all,
Could you pls tell me how to embed characters in dynamic textfield with as2 in cs4. i mean i want to add chines characters then what coding i have to write pls help me..
Thanks,
Vanita
Hi All, I’m using AS3 with CS4.
I’ve inherited a project with multiple runtime-loaded SWF files. I think our strategy is to embed as many fonts as we can but I’m not sure the actual implementation is sound.
Here’s what I can describe:
Our main SWF embeds .OTF fonts directly from disk. We have a set of these OTF files that are available to all developers of this project.
Authors of dynamic swfs (artists hooking up a new dialog box, for example), create dynamic text, but the font they choose from aren’t exported in that FLA file. They choose from one of the OTF fonts mentioned above, which are also installed as system fonts on our machines. The author also specifies that the proper characters (digits, punctuation, etc) are embedded in the text field.
When those runtime swfs are loaded and we want to replace their text (with something localized), I see that the textfield’s ‘embedFonts’ member is set to false. I use the font specified in the Textfield’s defaultTextFormat member to look up a mapping in our main SWF, and then poke an embedded font back into the default text field.
This kinda longwinded but it sums up how things work. My questions are:
1) When someone specifies a character embedding on a textfield in Flash, shouldn’t the AS3 representation of that textfield have its ‘embedfont’ member variable already set to true?
2) Is it even proper to specify a character embedding (character ranges) in the textfield if we’re not exporting any fonts from the SWF that contains that text field?
Thanks very much in advance,
Jeff
This will not work with certain fonts (e.g. Myriad Pro on Windows).
what font do I have to use to display arabic characters
how can I change the width and height this XML Flash Voting Script?? I use setting2.xml file for my poll.
Pls help…need your respon as soon as possible…n thank u for your cool poll script!!!!!
Please help me. I want to use input text with my customized font.It is like utf-8. So how i do i please help me. I use flash software CS4. I am so not good write English. Please…
blog entries 

Products RSS Feed
Follow us on twitter
Senthil
August 17, 2009 at 10:05 am
But when you embed fonts and try to apply bold or italics through formating which never works, have you ever tested it