As3 Embedding Fonts And Using Variations In Textformats
Hello,I'm posting this to help others who have searched for help on this topic and only found Flex examples with embed tags etc.Platform: AS3 in flash IDEScenario: I want to - embed fonts- be able to change the textformat applied to a textfield in order to switch the font between Verdana normal to Verdana boldSolution: 1) Add two new fonts to the library, both Verdana, one with the 'bold' checkbox ticked and one without. The class and name fields you choose do not matter, but do export for actionscript on the first frame.2) Create a TextField on stage with the instancename 'input'. Rotate it since only embedded fonts will show in rotated textfields.3) Create two Buttons on stage with instancenames 'b1' and 'b2'4) add code to frame: Code: // Note that for a font with class linkage 'VerdanaNormal',// new VerdanaNormal().fontName == "Verdana", and this is// the value that TextFormat expects for the .font property.// The crux here is that the same font was added// to the library twice, once for each variation,// and the class linkage and name are not used here.var tf1:TextFormat = new TextFormat();tf1.font = "Verdana";tf1.bold = false;var tf2:TextFormat = new TextFormat();tf2.font = "Verdana";tf2.bold = true;input.embedFonts = true;input.htmlText = "This is the text to test with."b1.addEventListener(MouseEvent.CLICK, onB1Click);b2.addEventListener(MouseEvent.CLICK, onB2Click);function onB1Click(eo:MouseEvent) { trace("setting tf1, .bold=false"); input.setTextFormat(tf1);}function onB2Click(eo:MouseEvent) { trace("setting tf2, .bold=true"); input.setTextFormat(tf2);}
KirupaForum > Flash > ActionScript 3.0
Posted on: 12-11-2007, 09:39 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
I Hate Fonts - All Font Variations Not Showing In Flash Menu
Hi folks
This same subject has infuriated me for ages, but ive managed to 'muddle' through.
In our company all the visual designers use Macs and pepper the designs with font light dark italic you name it they use it if they can. Whilst all the authors/coders/developers are on PC.
However when importing the the font onto my PC for flash development some strange things happen and always have.
I am no expert on fonts never have been, never profess to be and never want to be - so please excuse my ignorance.
1 the fonts dont show in flash - can anyone tell me why this is
e.g. i have installed DIN light, dark and regular yet in flash only DIN displays yet it asks for the others
2 when i check in the windows fonts the DIN fonts imported although showing up as true type have one of two file icons
(i) like an italic green O
(ii) two T's overlaid one blue one green
Could this be the route of my problem.
Can i resolve this in flash and how as it is driving me up the wall.
And no clever answers about Macs and PCs please both have their uses.
Thanks
J
Embedding Fonts
Ok, I just want to clear this up for myself. I know that if I want the user to see the font I have selected in a dynamic text box, I need to embed the font. However, for a static text box, is the font automatically embedded?
TIP - Embedding Fonts
Here's a tip many might appreciate . . .
If you're sick of resorting to unnecessarily large .swf's because you want to embed a font, or maybe export without embedding a font, presenting the perfectionist's nightmare - Bad Formatting & Size Distortions due to someone's system having no close alternative to the intended font, then here's a tip:
Import your font(s) into 'a' .swf (making sure it's 'imported' into it's library, by setting the fon't property to 'export' - which embeds the font into the .swf when it's exported). Now name the .swf as Library.swf or something.
Now, when you create your main .swf movie, and/or (to be) loaded .swf pages etc, don't select 'embed' font on any of the texts which are to grace your fabulous font. Instead, go to 'file' and 'load imported library', and search for you Library.fla. Once selected, you'll then see that library window open - Drag the font from that library window (titled 'Library' or whatever you called it), onto your main movies library. It'll have the description 'imported' under the properties of the library window.
Select the text(s) on the stage of your main movie, then select the font from the text property window (which will have an asterix character after it's name) and hey presto!
All .swf's that load the font from that single Library.swf, will now be saved from 20KB+, which is good news if you use loadMovie alot.
Appologies for the somewhat 'uncoherent' walkthrough, but this college PC is making typing rather difficult.
Hope this helps some (if not many) of you fellow Flashers,
::bluemoth::
About Embedding Fonts
when i put my link matter in a particular font that time that font should be on client pc. Or i have to break apart the whole matter and do. If i break apart the matter then the file size increases more. Plz help me how i can embed font with my file.
De-embedding Fonts
Hi all. I'm having a problem removing some embedded fonts that I used in a previous version of my movie. despite the fact that they are no longer used in any of my symbols, they still appear embedded in the size report. Does anyone know of a way of getting around this, ie having a third party swf tools type thing that lets you inspect the code and muck about with it?
ta.....
Embedding Fonts
I have a swf in flash mx, with a Rotis font. I am having trouble having this font show up on all computers. How do I embed the font into my movie so that people who don't have this font on their computer will still see it?
I read the help site about font outlines and font devices but it really oes make sense to me?
Help?
Embedding Fonts
Hi Flash people
I've created a couple of AS dynamic text boxes and I need to mask some of them. I understand that I need to embed fonts in order to do this, but I dont know how.
Can anyone tell me how to embed fonts?
Thanks for any help in advance.
-Jae
Integrate
Embedding Fonts In MX
Hello there,
I had originally created me site in Flash 5 and everything was running fine. I recentley upgraded to MX and some things seem to have gotten messed up in the process and I hope some one out there can help me..
.Problem one: When opening me FLA file, it says that the fonts that I have used are not available on my system and do I want to replace it with default...I navigate to the font that I am using and tell it to use that font...and to this point things seem to be fine.
But when I export the movie, it says that the outline to the font that I am useing is not available and in the swf file the fonts that are not embedded will disapear....why didn't this happen in flash 5...
Also I HAVE all the fonts that I am using in my system folder and they are activated....and my last question is please tell me HOW TO EMBEDD FONTS IN FLASH MX so that this problem wouldn't happen again.
here is the address to my old site, where I was trying to fix the scroll bar on the photopage when all hell broke loose
http://www.ezenhari.com
THANKYOU SOOO MUCH,
Ellie
Embedding Fonts
I've read here and in books that if you use static text that this automatically embeds the fonts into a Flash movie.
Maybe I don't understand this clearly. I'm working on a site right now that I've used static text with some uncommon (non-windows) fonts. I sent my client my font library, she picked her fonts--the non-windows fonts. When I threw up the site live, she insisted that the fonts she chose weren't up there. Sure enough, when I looked at the site on another computer, windows default fonts replaced the ones she chose.
Why? Again, the fonts were static fonts.
(One thing I noticed later was that for the title, I did check the "use system fonts" as an experiment and forgot to uncheck it later. However, the other font texts were definitely never checked in the same way and were still replaced.)
I really don't want to break apart the fonts because it's a hassle later when editing text. I'm thinking of importing the fonts if there's no other solution, but I'm trying to stay light weight with this.
Thanks.
Embedding Fonts
Is there a way to embed fonts for the entire movie with actionscript without having to embed on every single text field?
I noticed the pet market application does it I just can't follow it.
Thanks
Embedding Fonts
the button to embed fonts in my property window has simply vanished. What's the deal? What would happen if I don't manually embed a specific font?
Embedding Fonts
Hi,
I have a site im making with dynamic text boxes, everyone of which uses a pixel font which of course has to be embedded. Is there a better (less filesize) way of embedding fonts than just clicking embed all characters etc. Like is there a way to embedd it for the whole .swf and ones loaded into it in one go.
Thanks
Embedding Fonts
If I use a font in multiple places in a movie, must I embed fonts for each or does embedding the font once apply to the movie as a whole?
Signed,
- "Trying to figure it out, while i wait for a response"
Embedding Fonts
I have several movies that need font embedding, all for the same font. However, all of the movies will be accessed via being loaded into another SWF.
If I embed the font outline in the primary SWF, will all other SWFs loaded into that have the font embedded? If not, is there any way to achieve such an effect?
Thanks!
--Brad
Embedding Fonts
Is there an easy way to embed all the fonts on your movie? Instead of having to do each one seperatly?
Is there a better way of doing it than using dynamic text?
Answers on a postcard.....
Embedding Fonts
Hello,
I have htmlText that I get from a database. this text includes bold italic and underline Tags.
when the text shows up in flash and the font of the textfield in which it shows up is not embedded, then everything shows up fine.
but when I embed the font, the bold,italic,.. tags aren't visible.
Is there anyone who knows how to fix this?
Embedding Fonts
Hello everyone,
I know this sounds like a stupid question, but I have this font I REALLY want to use, so how can I embed it in the .swf?
TIA,
beeman
Fonts Not Embedding?
Hello there,
im making a site at the moment, errm, only just started it. But im using the font Myriad cnWeb, but for some reason on Export the font is not being embedded.
they are buttons, and not dynamic text fields or anything. so i dont know why?
ive attached the file to see if anyone could help me (never had a problem with this b4), its probably something really simple n i need my brain tested.
Iain
iduff@grdata.co.uk
Embedding Fonts
I had a question concerning fonts. I have a preloader that for some reason shows up in different fonts depending on what computer it is being viewed on. Is there a way to ensure that the same font shows up on all computers. Thank you
Embedding Fonts
Hi,
I have been using pixel fonts recently and know that if I set the text boxes up as 'dynamic' and select 'embed font outlines', they will appear identical for every viewer, does the same apply for basc fonts (ie Arial, Verdana etc.)?
Embedding Fonts
Heya guys,
I was wondering if there are any tricks when it comes to embedding fonts.
I'm using pixel fonts and haffa embed them to get them all crispy. but my question is are there any tips when it comes to embedding fonts? how to get the file sizes down to a minimal etc.
the main problem im having is that im using a pixel font in the loader to read "loading" and then "complete", when i embed the fonts its like 7kb, but when i dont its about 1kb. and then when i view the movie by the time the loader has loaded the movie is already 25%. it takes time for the preloader to load basically.
once ive embedded the font for one textbox, do i have to embed for the other? are there any guidelines i should follow?
if you have any tips or tricks, or techniques that work for you, id love to hear them.
thanx
Ross
Embedding Fonts
I`m from Croatia and here we have letters that are not common to English!
ščę are not displayed correctly when read from an external .txt file into dynamic text field!
I tried embedding fonts and I defined range from a-z, A-Z etc. and included the upper letters also, but now they don`t display at all!
When I included some other characters additionally they worked fine but ščę simply don`t show at all!
By the way I`m using MX 2004 v7.2
Help!
Embedding Fonts
why is it that when i embed the font and call it it appears differently than if I just name it without embedding it....
...also why does text in a dynamic text field appear differently than a static one
Embedding Fonts
Do you have to embed all the fonts you need in every mc? or can you embed what you need in _level0, and expect all other loaded mc's to have the fonts available? If not, is there a way to do this?
CSS Or Embedding Fonts
which way is the best way to go?
linking css via php or just embedding the font
im planning on trying out both unless i hear otherwise
Fonts Not Embedding?
Can I embed all the fonts I need in _level0, making them available to any mc loaded into subsequent levels?
I tried creating dynamic TextFields for all the fonts I need in _level0's main timeline, I also embed the fonts in each one. I assumed that these fonts would be available for dynamic TextFields that use these fonts in subsequent levels. This does not seem to be the case.
Can I do what I am trying to accomplish?
Thank you.
Embedding Fonts
I am using Futura Maxi Bold and Futura Maxi Book, and want to embed only numerals and punctuation. However, when I fill in the characters to embed in the properties window and test the scene, the desired embedded text is no longer even shown on the screen. WHen I turn off the embedding option everything returns to normal.
Am I doing something wrong or are some fonts just un-embeddable?
Thanks,
Brian
Embedding Fonts
I have several dynamic text boxes throughout my flash document that use a total of 3 separate fonts. Do I need to embed those fonts in each and every dynamic text box, or can I just embed each font once (so 3 times total), and that will suffice.
Also, one of the dynamic text boxes has some masking on it. I'm not sure if that has any bearing on the answer.
Thanks to anyone that can help,
el clandestino
Embedding Fonts With CS3
Hi, I'm having problems embedding entire fontsets with CS3. I wish to do this compile-time without using another swf file as a library. I tried the following code, but it does not embed the font:
PHP Code:
// this is the file that contains the Document class etc.
package {
import flash.display.*;
import flash.text.*;
import flash.utils.*;
[Embed(source="C:WINDOWSFontspcsenior.ttf", fontName="PC Senior")];
public class Platform extends MovieClip {
public function Platform() {
var format:TextFormat=new TextFormat ;
format.font="PC Senior";
format.color=0xFFFFFF;
format.size=12;
var label:TextField=new TextField ;
label.embedFonts=true; //When I comment this line, the text is displayed correctly.
label.autoSize=TextFieldAutoSize.LEFT;
label.defaultTextFormat=format;
label.text="Hello World!";
this.addChild(label);
}
}
}
What's wrong?
Embedding Fonts In CS3 - I Don't Get It
Hi, yet another problem with font embedding in CS3.
Here I try to embed the Arial font as a bitmap font, but the text does not show up when .embedFonts is set to true. Why?
Code:
package {
import flash.display.MovieClip;
import flash.text.*
public class Fontclass extends MovieClip {
var myText:TextField = new TextField();
var myFormat:TextFormat = new TextFormat();
public function Fontclass() {
myFormat.color = 0x000000;
myFormat.font = "myFont"; // Arial font placed in library
myFormat.size = 12;
myText.embedFonts = true // Uncomment this line, and the text shows
myText.text = "This is the text that shows up in the upper left corner if embedding works.";
myText.x = 0;
myText.y = 0;
myText.autoSize = TextFieldAutoSize.LEFT;
myText.setTextFormat(myFormat);
//myText.defaultTextFormat = myFormat;
addChild(myText);
}
}
}
Embedding Fonts
Hello,
I've managed to embed fonts on a textfield I create in actionscript, but when I make a textfield on the stage and then try to use an embedded font on it, it won't work(I gave the textfield an instance name and set embedFonts to true, and gave it a new TextFormat as well). Do I have to create textfields with embedded fonts in actionscript, or is there some way to do it the other way as well? :P
Thanks in advance!
Embedding Fonts
I'm creating a page that a user can log into. I am using actionscript to fade a movieclip out. I noticed, however, that the input textfields in this movieclip do not tween. So of course I went and embedded the font I'm using, thinking this would work. But it didn't. It isn't that it still doesn't tween, but rather that the user cannot enter anything into the textboxes at all. Just to make sure I hadn't changed another property without knowing it, I unembedded the first input textbox, and now it works fine, but of course it still doesn't tween. What's going on here?
Any help would be greatly appreciated
Mavrisa
Embedding Fonts
Hey, I need to embed fonts because I am using input text fields behind a mask. My question is do I need to embed the font outlines for every text field in the form? It seems so because if I skip one the font does not show in that field but I have four forms so the movie loads really slowly. Is there a better way?
HELP,
-M
Embedding Fonts
I'm having a problem getting this to work, maybe I've missed something fundermental. Anyway, I first added a font to the library and did the linkage with the export to action script and gave it an identifier Font_MSS.
then in the following code I added the line to the // format the font for the scroller text with this
Code:
// format the font for the scroller text
scrollerTxtFormat = new TextFormat();
scrollerTxtFormat.embedFonts = true;
scroller.setTextFormat(scrollerTxtFormat);
although the text does show up it has no effect on the font itself.
any ideas?
many thanks
Cheers Rob.
Code:
// Loads the XML file
#include "external as/xmlnitro.as"
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("xml/StringAboutText_XML.xml");
// Variables to hold the node and attribute values from the XML file.
function loadXML(loaded) {
if (loaded) {
_root.scrollerTxt = this.firstChild.childNodes[0].firstChild.nodeValue;
// Create empty textfield called scroller
_root.createTextField("scroller", 14, 40, 270, 500, 162);
//scroller.embeded = true;
scroller.type = "dynamic";
scroller.multiline = true;
scroller.html = true;
scroller.wordWrap = true;
scroller.selectable = false;
scroller.htmltext = _root.scrollerTxt;
// format the font for the scroller text
scrollerTxtFormat = new TextFormat();
scrollerTxtFormat.embedFonts = true;
scroller.setTextFormat(scrollerTxtFormat);
// create a scrollbar for the scroller text
_root.initialization = {_targetInstanceName:"scroller", horizontal:false};
_root.attachMovie("FScrollBarSymbol", "scrollBar", 15, initialization);
scrollBar._x = scroller._x+scroller._width+15;
scrollBar._y = scroller._y;
scrollBar.setSize(scroller._height);
// Format the scrollbar
scrollBar._width = 15;
scrollBar.setStyleProperty("arrow", 0x000000);
scrollBar.setStyleProperty("scrollTrack", 0xFFFFFF);
scrollBar.setStyleProperty("face", 0xFFFFFF);
scrollBar.setStyleProperty("highlight", 0xFFFFFF);
scrollBar.setStyleProperty("highlight3D", 0xFFFFFF);
scrollBar.setStyleProperty("shadow", 0xFFFFFF);
scrollBar.setStyleProperty("darkshadow", 0x000000);
} else {
trace("xml file not found!");
}
}
Embedding Fonts In CS3
Hi, I'm having problems embedding entire fontsets with CS3. I wish to do this compile-time without using another swf file as a library. I tried the following code, but it does not embed the font:
Code:
// this is the file that contains the Document class etc.
package {
import flash.display.*;
import flash.text.*;
import flash.utils.*;
[Embed(source="C:WINDOWSFontspcsenior.ttf", fontName="PC Senior")];
public class Platform extends MovieClip {
public function Platform() {
var format:TextFormat=new TextFormat();
format.font="PC Senior";
format.color=0xFFFFFF;
format.size=12;
var label:TextField=new TextField();
label.embedFonts=true; //When I comment this line, the text is displayed correctly.
label.autoSize=TextFieldAutoSize.LEFT;
label.defaultTextFormat=format;
label.text="Hello World!";
this.addChild(label);
}
}
}
What's wrong?
Embedding Fonts
I am embedding fonts dynamically into my TextFields and it is working OK. The problem I am having is that static textfields that are part of clips in my Library that are using the same font get all messed up and they look different as soon as I embed the font into the library.
Any ideas?
Thanks for your help.
Nathan
Embedding Fonts For CS4?
I guess I haven't been paying much attention to new features in CS4, but I just opened a file that I created with CS3 that had fonts embedded and now they're not displaying. I've done the embedding the same old school way of just sticking empty text fields on the stage for years so I guess I need to learn the new formal way, but I haven't had any luck.
I'm using a font that has separate bold and italic faces and I need to embed them all, which seems to be whats tripping me up. I need all three faces to show in one text field. It looks like the font panel in CS4 is a little different (Family/Style)?
Can someone please outline the steps I need to do to get all the different styles of a family embedded correctly so that I can use them in a single textfield that I've added to the stage in the IDE?
Thanks!
Embedding Fonts Help.
Right guys i dont want to get into some big letter writing essay thing explaing what i am doing. Below is a link to the swf
http://www.innovativedesigns.org.uk/...swf/login.html
If you login and then click on Jamie news it will load the news. U wont see the problem till you add a new Story.
When you do add a new Story make sure you have some text set bold and italic(hit submit).
You will need to hit the jamie news button a few times to load up the new data from the db(ruff flash).
Anyways once you see your post is loaded if you had some text bold or itlaic you will see that it does not show(the bold/italic text is not there) but yet if you hit edit post it shows up. I know that this has something to do wiht embedding fonts. On the jamie news view the fonts are embedded, in edit news and post new they are not, if i try to do the same with news view, the scroller mask doe not mask the un-outlined text but does show the bold and italic text
Anyone any ideas
Embedding Fonts
My designer has choosen the following font for the flash piece we are doing
AkzidenzGroteskBE-XBd
How do I go about embedding this font? If I make the text dynamic, and then select the Character tab, I don't see any font's like this listed in the range of characters.
Thanks
Embedding Fonts
OK, I found an example of what I need to do, and I'm wondering if anyone can explain to me how to do this.
Here's the page: http://www.dislogic.be/content.html#typography
He's embedding fonts and you're able to use them to type in the text fields EVEN THOUGH those fonts aren't installed on my machine. Can someone please explain to me how to do this. I've tried several different ways and have come up empty
Thanks
IC
Embedding Fonts
If I embed outlines of a font in just one text box, will all other text boxes have those outlines aswell? And is there a way to embed all letters(upper and lower case) and numbers....besides typing them in (im kinda lazy)
im running Flash MX 2004
Embedding Fonts
Please could someone help me out on this one its sending me over the edge...
I have several text fields in my movie some are static text boxes and some input fields. Now all of them are set to a certain font and this is not the problem, the problem is that i have dynamic text fields which wont let me embed the font into....
Is there a way to embed a font into a dynamic text box
XML And Embedding Fonts
Hello all.
I have created an XML file and used the CDATA tag inside one of the nodes so I could display a URL and some HTML. I then run the code in my flash file and everything works great.
I then decide that I need to have the fonts anti-aliased. In order to do this, I have to embed the fonts for the dynamic text boxes. So I do that and then publish and open the file. Sweet, anti-aliased dynamic xml copy...oops but one problem...WHERE'S THE LINK?!?!?
When I embedded the fonts, the link disappeared. If I don't embed fonts, it shows just fine. Any reason for this? Are there any workarounds? Thank you very much in advance.
Help With Embedding Fonts
I am using Flash MX.
I read on here about how to embed a font (Library > New Font...) but I'm finding that the font I've (supposedly) embedded isn't appearing correctly on any other computer that does not have that font installed. To be precise it's a pixel font I found on the web (From Fonts For Flash.com) that apparently can be embedded without any problems. All the text fields in my movie are dynamic.
Can anyone suggest how to resolve this? Am I doing something wrong? The font does need to be a pixel font because of how small the letters need to be.
Thanks in advance.
Edited: 06/07/2007 at 03:56:34 AM by matt_deejay
Embedding Fonts
Hello, I have file a question re: Flash and fonts.
At work, I'm putting together a Flash piece in simplified Mandarin. I'm using Arial Unicode, and the text looks great in the file. But when I preview the file, the characters become question marks.
I'm sure I need to embed the font (arial unicode) in the file, but I don't know how.
Embedding Fonts
I'm working on a Flash project, in which I embed several characters from the fonts "Arial" and "Monotype Corsiva". Arial is also embedded in Bold. I do this by clicking the "Embed..." button in the IDE and typing out the characters I wish to embed. I use static, dynamic, input text fields with from 8pts to 14pts, in case it matters. This works fine, and I can access the embedded fonts throughout the movie.
Here's the problem: When I generate a size report, I see
...
Arial Bold 10806 !"#$%&'()*+,-./01234567...qrstuvwxyz{|}~µāāā¬
Monotype Corsiva 12938 !"#$%&'()*+,-./01234567...qrstuvwxyz{|}~µāāā¬
Arial 12311 !"#$%&'()*+,-./01234567...qrstuvwxyz{|}~µāāā¬
Arial 9 pts 9610 !"#$%&'()*+,-./01234567...qrstuvwxyz{|}~µāāā¬
...
I understand why "Arial Bold" is there. However, I do not see why "Arial 9 pts" in there.
The reason why it puzzles me is that I use many different font sizes for the Monotype Corsiva font, and it only shows up once. Furthermore, there's a dynamic textfield which uses Arial at 10 pts (and most dynamic fields are 8 pts), yet that doesn't get embedded. What makes Flash embed the Arial font again for the 9 pts size, and how can I prevent it from doing that?
Stuff I tried:
- I used a JSFL file which changes the font size of every field to 8 pts. This results in Arial and "Arial 8pts" getting embedded.
- I used a JSFL file and changed the font size of every field to a different, random size. This results in all those different sizes getting embedded.
- I added a text field which uses Arial at 10 pts, and nothing additional gets embedded.
- I added a text field which uses Monotype Corsiva at 10pts, and one at 16pts, and nothing additional gets embedded.
Thank you for your time and help
Edited: 09/30/2008 at 11:58:53 AM by Stefan Fr
Embedding Fonts
I'm embedding an Arial front but when I try to use the character "ā " it doesn't show up. The weird thing is if I change the font to bold it works. any idea why?
Note:
I do not have bold selected in my library font.
Thanks
Josh
Embedding Fonts
baby_mc.label3.setStyle("color", _root.accordion.section1_mc.combobox.selectedItem.data);
baby_mc.label3.setStyle("embedFonts", "true");
The fonts aren't loading into a dynamic label unless already in the system. Is there a way to do this?
Embedding Fonts Once
Is there any way of embedding a font once and then making this available for any dynamic text field in a movie? I don't want to inflate the swf any more than I have to just because I'm using a particular font in various clips.
cheers
|