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”;
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.
“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!
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?
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?
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)…
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.
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!
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 and I’ll send you the file…
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. 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. )
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
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.
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!