Skip to main content
Venian
Inspiring
March 7, 2013
Answered

Using loaded fonts in child swf

  • March 7, 2013
  • 1 reply
  • 1028 views

Hello,

I have an ad container that loads a handful of resources of which some are fonts and some are swfs. My problem is that the font is loaded from an url, is registered and works fine embedding it to the textfields created in the ad container. The problem is that when I try to embed it to the textfields in some of those loaded SWFs it does not work.

The font loads and gets registered before the swf gets loaded. The SWF file then gets an event telling it to embed the font there as well. While checking, from within the child SWF file, the Font.enumerateFonts() array I can see that the fonts have been succesfully registered. My problem is that even if that array shows me the fonts, when I try to embed them in the child SWF file nothing appears. I even use something like myTextFied.font = Fonts.enumerateFonts()[0].fontName, while embedFonts is set to true and antiliasing is set to advanced.

I tried it in all manner of ways and none gives me any results. The font which is loaded is stored as a library item with Linkage inside a SWF file. So to load a font I load SWF file containing that font. It works fine for the ad container (main SWF) but not for children SWFs.

Any suggestions?

Thank you a lot!

Vlad

This topic has been closed for replies.
Correct answer Andrei1-bKoviI

You may need to create instance of font class and register font in every loaded swf. This is an RSL approach.

This post outlines the idea:

http://krasimirtsonev.com/blog/article/AS3-flash-runtime-font-loading-embedding

1 reply

Inspiring
March 7, 2013

Try to load secondary SWFs into the main SWF domain context.

Venian
VenianAuthor
Inspiring
March 8, 2013

I loaded it in the main SWF's ApplicationDomain and nothing.

Andrei1-bKoviICorrect answer
Inspiring
March 8, 2013

You may need to create instance of font class and register font in every loaded swf. This is an RSL approach.

This post outlines the idea:

http://krasimirtsonev.com/blog/article/AS3-flash-runtime-font-loading-embedding