# \[FMX\] problem displaying fonts w/.embedFonts & .createTextField

**URL:** <https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115>\
**Category:** flash\
**Created:** [November 14, 2002, 12:41am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115 "2002-11-14T00:41:55Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_X](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Mr\_X](https://forum.kirupa.com/u/Mr_X)\
**Post date:** [November 14, 2002, 12:41am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/1 "2002-11-14T00:41:55Z")

</div>

I’m stuck on this one for the 2nd day and it’s driving me crazy! So I joined these forums in the hope to be enlightened by some Flash guru 🙂

OK, so I’m making a site with 4 main buttons. Each of them send you to the sub-section and I’m making the sub-category buttons from 4 arrays with the names of each subCat and a .duplicatMovieClip loop.  
My problem is that I can’t get the font I’m using (Adobe “Myriad Web Bold”) to display those subCat…  
I tried using a “dummy” dynamic text field off stage with embedded font as well as adding/linking the font into the library.  
When I do a “Size Report” the font seem to be embedded but the text doesn’t show up. When I set “.embedFonts = true;” to “false” then the text comes back (but in device font of course…)  
I’ve tried everything I could think of but I’m stuck…  
I’d be glad to send the .fla to anyone with time to help… 🙂

Here some of the code:

// creates the new buttons  
for (i=0; i \< subCat\_array.length; i++) {  
\_root.subCat\_masterBT\_mc.duplicateMovieClip(subCat\_array\*+"\_mc", 100+i);  
\_root[subCat\_array\*+"\_mc"].\_x = \_root.subCat\_masterBT\_mc.\_x;  
\_root[subCat\_array\*+"\_mc"].\_y = \_root.subCat\_masterBT\_mc.\_y-(\_root[subCat\_array\*+"\_mc"].\_height\*(i+1));  
// add text to each button  
\_root[subCat\_array\*+"\_mc"].createTextField(subCat\_array\*+“TXT\_mc”, 150+i, 0, 0, 150, 20);  
\_root[subCat\_array\*+"\_mc"][subCat\_array\*+“TXT\_mc”].text = subCat\_array\*;  
\_root[subCat\_array\*+"\_mc"][subCat\_array\*+“TXT\_mc”].embedFonts = true;  
\_root[subCat\_array\*+"\_mc"][subCat\_array\*+“TXT\_mc”].multiline = false;  
\_root[subCat\_array\*+"\_mc"][subCat\_array\*+“TXT\_mc”].setTextFormat(\_root.subCat\_TXT);  
}  
};  
// text formatting for the subcategory’s submenus  
subCat\_TXT = new TextFormat();  
subCat\_TXT.color = 0xFFFFFF;  
subCat\_TXT.size = 14;  
subCat\_TXT.align = “right”;  
subCat\_TXT.font = “Myriad Web Bold”;

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 1:17am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/2 "2002-11-14T01:17:52Z")

</div>

i notice that your setting the text format of the buttons to subCat\_TXT before defining subCat\_TXT.

is that the same order as in your fla?

setting the font of the TextFormat object can be a little tricky. if it’s not exactly right (including bold, italic, underline) it won’t work. it’s not case sensitive however, you can use caps indiscriminately.

what will work across the board, is using the name you export it as in the linkage option from the library (which can be anything). this is not the same as the name of the font object as it is displayed in the library, but the name which appears in the linkage options.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 7:36am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/3 "2002-11-14T07:36:09Z")

</div>

“i notice that your setting the text format of the buttons to subCat\_TXT before defining subCat\_TXT. is that the same order as in your fla?”

yes, it’s in the same order. But I don’t think it matters since the code you see is actually part of a function I created: subCat\_BTcreate = function (subCat\_array) {…  
Those subCat buttons are created only when the function is called from a on (Release) on the main Category’s buttons. Plus, all the other attributes of subCat\_TXT (color, size, etc…) work fine…

“what will work across the board, is using the name you export it as in the linkage option from the library (which can be anything). this is not the same as the name of the font object as it is displayed in the library, but the name which appears in the linkage options.”

I tried setting the linkage identifier as “myFont” and then putting:  
subCat\_TXT.font = “MyFont”;  
but that did not work either… That’s what you mean right?

Anyway, thanks for the help and sorry about the cross post in Flash MX section, I arrived their through a search and realized there was an AS section only after posting in MX… SORRY! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 7:41am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/4 "2002-11-14T07:41:42Z")

</div>

No need to be sorry Mr. X, just we get A LOT of people here that post their question in every section thinking it will help them get an answer faster.

Your question was actually applicable in either this or the MX section.

As for the problem, I don’t think I have experienced that problem before, so I don’t know of a solution. Did you try doing this with a different font at all?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 8:19am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/5 "2002-11-14T08:19:40Z")

</div>

_I tried setting the linkage identifier as “myFont” and then putting:  
subCat\_TXT.font = “MyFont”;_

yeah, that’s what i meant…

hmmm.

lib’s suggestion of trying with a different font is a good one.

try something like this in an empty fla:

```auto

_root.createTextField("txt",0,0,0,0,0);
_root.txt.autoSize = "left";
_root.txt.text = "hi, i'm arial";
_root.txt.setTextFormat(new TextFormat("myFont",18));

```

you need to create a font called “myFont”.

i found i didn’t even have to export it. bizarre.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 8:29am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/6 "2002-11-14T08:29:00Z")

</div>

Hey sbeener, I notice that lets you choose any font on your computer, which is pretty cool, but how does that help it on the web?

It would be so much easier if this was like CSS and you could upload the .ttf font to your server and link to it so everyone can see it. I am supposing that isn’t possible right?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 8:59am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/7 "2002-11-14T08:59:06Z")

</div>

Thx sbeener,

ok, I’m starting to wonder if there’s something that I’m really missing in the font embedding busines… Maybe something so obvious that you didn’t think about mentionning? All I know about embedding fonts is what I read in the online Help and it’s pretty sparse…

So, I just copied/pasted the code you gave me in a brand new .fla and I added a font called “font 1” in the Library. Then I went to Linkage, selected “export for ActionScript” and gave it an identifier name: “myFont”.  
Then I selected my problematic font in the Property window (the one you get w/ right click on the font in lib) and it did not work.  
Then I selected Arial, Helvetica, and Courier (in the “lib/right click” property) and each time I get the same default browser font (Times or something like that…)! Did not work, even with Courier…

I’m on OS X 10.2.2, Flash MX, I tried the published .fla in IE 5.2, and Chimera (Mozilla based OS X browser)…

Any thoughts?..

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 9:25am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/8 "2002-11-14T09:25:39Z")

</div>

on the size report of the test .fla w/ the code you gave me, I get this

```auto
Movie Report
-------------
FrameFrame # Frame Bytes Total Bytes Page
------------ ----------- ----------- ---------------
    1 21212 21212 Scene 1

Page Shape Bytes Text Bytes
----------------------- ----------- ----------
Scene 1 0 89

Sound name Bytes Format    
----------------------- --------- ----------
Arial 20800 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨!=ÆØ?±&lt;=&gt;=¥µ?&lt;sum&gt;?&lt;pi&gt;?ªº?æø¿¡¬?ƒ??«»…_ÀÃÕŒœ–—“”‘’÷?ÿŸ/€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ?ÒÚÛÙ?ˆ˜¯&lt;breve&gt;??¸´´?&lt;caron&gt;

```

is it supposed to say “Sound Name” down there? I’d expect it to be called “font name”… Could you check what it says on your system? thx.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 5:05pm UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/9 "2002-11-14T17:05:33Z")

</div>

lib - flash embeds the font information in the swf. i agree, linking to a ttf would probably be simpler. one upside to the way it works now is that you don’t need to embed all the characters.

X - strangeness… my bandwidth report calls it a sound too so i think you’re ok there.

i can’t see what’s missing for you. my initial impulse is to blame osX. ; )

here’s a fla and swf containing code that works for me. you may have to re-embed the font, i’m on a pc.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 14, 2002, 5:39pm UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/10 "2002-11-14T17:39:50Z")

</div>

ok, your file looks pretty much identical to mine. I don’t really understand what you mean by “you may have to re-embed the font”  
The .swf should show up as Arial no matter on what OS right? That’s the purpose of embedding in the 1st place… Anyway… It doesn’t… ☹  
Then I just went ahead and tried selecting my own Arial font and re-publishing the .fla, just in case… Did not work…  
I don’t feel really comfortable posting the .fla here since it’s going to be someone’s site. But I’d be glad to e-mail it to you if you have time to check if it works on your system.  
This thing is starting to look like a bug to me… 😉  
thx again for your help! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 15, 2002, 3:49am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/11 "2002-11-15T03:49:32Z")

</div>

umm, oops.

i forgot to add:

\_root.txt.embedFonts = 1;

let me know if that clears up the problems in the test file.

i pm’ed you my email. it’s been bouncing back for most of the afternoon … grrr … but should be working again soon.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 15, 2002, 9:39am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/12 "2002-11-15T09:39:44Z")

</div>

yeah, with this extra line, your .fla works. So, I can stop blaming OS X and get back to concentrating on my poor scripting hability… 🙂  
Sorry for such a basic question but, where do I view the pm on this forums? (don’t use forums much, it’s 4:37 am and I just don’t feel like looking through FAQs and stuff right now 🙂  
or you can e-mail me at [yb@mrxsss.com](mailto:yb@mrxsss.com) and I’ll send you the file…

THX!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 15, 2002, 9:48am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/13 "2002-11-15T09:48:12Z")

</div>

Personal Messages are a catagory at the bottem of the main Kirupaforum screen. Its the last forum below all the others.

(btw welcome to [kirupaforum.com](http://kirupaforum.com). and don’t worry about easy questions. I’m a seasoned 5.0’er and I couldn’t even begin to contemplate what you were asking in this thread. 🙂 )

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 15, 2002, 7:41pm UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/14 "2002-11-15T19:41:30Z")

</div>

thanks David. I’ll definitly stick around even after I solve my problem. Everyone is pretty nice around here. No attitude… It’s refreshing to see that on the net 🙂  
Sbeener, I e-mailed you the file. And I’ll take a look at it again now that I know it’s my scripting that sucks… But gotta go to work now ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 15, 2002, 10:41pm UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/15 "2002-11-15T22:41:35Z")

</div>

X, your scripting looks just fine to me!

i still have no idea why the fonts were not working. however, changing the duplicateMovieClip to attachMovie solved it for me. this has the added advantage of allowing you to remove the unused ‘seed’ clip from the stage

weird that it made a difference…

i’ve emailed you back the fla i amended. i changed a few other things too …

i made some of your functions MovieClip methods and encapsulated the text addition in it’s own method.

i used temporary variables to refer to newly created clips in some of the methods.

i changed the method of clearing the old menu.

of course you should feel free to change anything back or whatever.

cheers.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 22, 2002, 8:28am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/16 "2002-11-22T08:28:09Z")

</div>

never got a chance to thank you. Work got crazy and this project has been on stad by for a few days… I looked at what you did and I don’t know anything about prototype… I looked at the help in Flash but (as most of the time) it’s written by people that don’t understand that some of us are more comfortable with watercolors than calculators… Any tip on where I can find understandable info about prototype?  
Thanks again for the help! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 22, 2002, 8:30am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/17 "2002-11-22T08:30:25Z")

</div>

You can check the AS Tricks section on this site.

[http://www.kirupa.com/developer/actionscript/as\_tricks.asp](http://www.kirupa.com/developer/actionscript/as_tricks.asp)

Click on the link that says…“using prototypes instead of functions”

That is where I learned how to use prototypes.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 22, 2002, 8:39am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/18 "2002-11-22T08:39:32Z")

</div>

thx lib. Do you ever sleep? 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 22, 2002, 8:40am UTC](https://forum.kirupa.com/t/fmx-problem-displaying-fonts-w-embedfonts-createtextfield/8115/19 "2002-11-22T08:40:44Z")

</div>

Nope, thats the beauty of having a sleeping disorder 🙂
