3

I want to display "Hello World" with calibri.ttf using only AC3. How would I do that?

Found two solutions on the web but I cannot use any of them - The Adobe documentation site requires the use of Flash CS4. (Don't know how to use this in Flex Builder) - The embed tag method requires FLEX SDK

Is it possible to embed font with purely Actionscript 3 in an actionscript project using Flex Builder?

3 Answers 3

5

I was having a similar problem in a pure AS3 mobile project where I used Daniel's code (below from another answer), but it wasn't working for me.

Daniel's code

[Embed(source='/assets/calibri.ttf', fontName="Font", mimeType="application/x-font-truetype")]
private static var calibri:String;

The trick I found here was to add embedAsCFF="false" Since I was adding a True-Type Font (TTF) and not a Compact Font File (CFF), this small change worked for me.

Updated code

[Embed(source='/assets/calibri.ttf', fontName="Font", mimeType="application/x-font-truetype" embedAsCFF="false")]
private static var calibri:String;
1
  • 1
    I've been trying to solve this exact problem for hours. Thank you. Dec 13, 2012 at 15:16
3

Right-click on the library in your Flash Project, and you have the option to add the Font there. You can even just create an empty dynamic text field, and have it embed all the characters you need.

In the settings, you have the option to give you the compilation details, so when you compile the project you can see what was included, and in both cases you should see the font be included.

--edit-- right, sorry I understood that you're using Flash, my bad

you can use something like this

[Embed(source='/assets/calibri.ttf', fontName="Font", mimeType="application/x-font-truetype")]
private static var calibri:String;
1
  • I don't see the library option. I'm using Adobe Flex Builder. ActionScript Project
    – Jan
    Mar 8, 2010 at 7:46
0

Flex Builder includes the Flex SDK, and uses the SDK for compilation. In a pure AS3 project you'd thus use the embed tag to embed fonts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.