Loading font class fails when loader is being subloaded from app-storage://
Hi
I'm developing a presentation that has to work on Web(Pure AS3), Desktop, Android and iOS.
I make use of shared runtime fonts using same technique as illustrated here:
http://www.scottgmorgan.com/runtime-font-embedding-in-as3-there-is-no-need-to-embed-the-entire-fontset-anymore/
Specifically:
private function fontLoaded(event:Event):void {
var FontLibrary:Class = event.target.applicationDomain.getDefinition("_Arial") as Class;
Font.registerFont(FontLibrary._Arial);
}
Problem when running in AIR:
*AIR-SWF = SWF's compiled for AIR
*AS3-SWF = SWF's compiled for FlashPlayer
The AS3-SWF that loads the AS3-SWF-font is placed in the same domain as the AS3-SWF-font , namely app-storage://
The AIR-SWF that loads the AS3-SWF - that loads the AS3-SWF-font.swf - is, naturally, running from app://
So the scenario that fails is this:
app://AppLoader.swf > app-storage://MainAppUIAndFunctionality.swf > app-storage://fonts/fNormal.swf
When i'm testing my MainApp, just as test SWF's , just as regular web/html/flash.. it all works..
But when my mainApp is being loaded by my AIR loader, it doesent work anymore.
In the AS3-SWF's I've set communincation "Local Access" and applied System.allowDomain("*") which indeed makes me able to communicate both ways, all the way to the AIR-SWF (not directly, but by referencing objects/functions)
So..no security errors, still I supsect sandbox/domain issue ^^..
Any ideas how to make it work?
Edit:
After i try use:
var FontLibrary:Class = event.target.applicationDomain.getDefinition("_Arial") as Class;
Font.registerFont(FontLibrary._Arial);
The error i get is:
The value specified for argument font is invalid.
at flash.text::Font$/registerFont()
