Skip to main content
Aaronius9er9er
Inspiring
May 5, 2010
Question

Loading font at runtime for TLF in Flex 3.3

  • May 5, 2010
  • 1 reply
  • 1627 views

Hey flexers,

I have an app that's using the Flex 3.3 SDK.  We pulled the text layout swc from Flex 4 and are using a text flow in our app.  Previous to this we had been using the old TextField.

How do I go about loading in a font swf at runtime and getting a text flow to use it?  I've tried several things as posted on the forum and around the web and it never actually takes effect in the text flow.  Here are a couple questions I came up with along the way though:

When I compile the font swf from the font css, do I need to have embedAsCFF=true?

Should I be able to use StyleManager.loadStyleDeclarations() to load in the font swf?  When I do, I get the following error:

VerifyError: Error #1014: Class mx.modules::ModuleBase could not be found.

Any idea why or know how I would load in the font swf?

This topic has been closed for replies.

1 reply

Aaronius9er9er
Inspiring
May 6, 2010

Let me clarify a bit.  Here it says that I need to set embedAsCFF=true to use the font with FTE:

http://help.adobe.com/en_US/flex/using/WS0FA8AEDB-C69F-4f19-ADA5-AA5757217624.html

It's my understanding that in order to use embedAsCFF=true I need to be using the Flex 4 sdk.  However, when I convert the CSS to a SWF and attempt to load it into my Flex 3.3 app using StyleManager.loadStyleDeclarations() I get the error:

VerifyError: Error #1014: Class mx.modules::ModuleBase could not be  found.

It would appear it's because I'm attempting to load a font "module" that was built in Flex 4 into an app built in Flex 3.3.  Is it possible to load a Flex 4 module into a Flex 3.3 app?  Is there some other workaround?

Adobe Employee
May 7, 2010

Might be better to ask this question over on the Flex forum -- folks there are more likely to know the answer. But I'd suggest using the [Embed] directive instead of a CSS stylesheet.

There's some good information about embedding fonts in Flex here: http://blogs.adobe.com/aharui/2010/03/flex_and_embedded_fonts.html