This content has been marked as final. Show 6 replies
The backslash is the escape character. To use backslashes in your string
literal, you would need to escape them:
Duh, that works. I had tried escaping, as well, but I think I may have mistyped the font name I had been testing. Thanks!
Just to add my 2 cents here: I would copy the font into the project folder and reference it from there. That has the advantage of being able to move the project from person to person (in case some future person has to work on the project and they don't have the font loaded on their computer). Plus you should be able to check the font into a source code control system.
Oh, and make sure you have the copyright permission to use the font from the font's owner/producer.
Thanks, peterent. Keeping that font around makes sense, since I suppose then the embed code will use the path to the font. I assume this means you can embed with relative fonts, for cross-machine compatibility at the project level?
I'm using free and open source pixel fonts. There are actually quite a lot out there, many even specifically designed for Flash/Flex apps, so I may do a roundup. I'm hoping we see more of these in the future; for this kind of work having open fonts becomes really essential.
I wrote a class to construct a menu and embedded fonts in that class but when I try to call that class I get a "contains invalid data." if I don't embed the fonts then the class works. I am also embedding the font in main document and the text on the main page works fine. would be glad to post the code if that is supported here.
I have a similar issue happening. I am using AS3 and have this code in my file:
// package, import statements etc...
// the line below is the problematic line
[Embed(systemFont="..\\..\\..\\fonts\\arial.ttf", fontName="Arial (True Type)", mimeType="application/x-font-truetype")]
// now declare my class
public class ImageRotator extends UIComponent
The class compiles fine but when I try to run it I get the following runtime error:
"Error: Error #2136: The SWF file file:///C:/projects/photogallery_screensaver/bin/photogallery_screensaver.swf contains invalid data."
I've tried several things including changing the location of the font file, using a different font file, embedding a systemFont. But I always get the same error.