So I have a swf file with an embedded font I made in Flash Pro.
What I'm trying to do is dynamically load this swf into my project using LoaderMax and SWFLoader, then register that font so it can be used later. The swf is downloaded and stored locally beforehand. It seems to be loading the swf fine, the problem is when I try to register the font, it throws an error saying the class from the swf is invalid.
Code to load the SWF:
FontLoader = new LoaderMax( { onComplete: fontsLoaded, skipFailed: true } );
for(var i:int=0; i < mainXML.Fonts.Font.length(); i++)
{
name = mainXML.Fonts.Font[i].FontFamily.text();
fileName = File.applicationStorageDirectory.resolvePath("UpsellAssets/" + name + ".swf").nativePath;
FontLoader.append( new SWFLoader( fileName, { name: name } ) );
}
FontLoader.load(true);
onComplete function:
private function fontsLoaded(e:LoaderEvent):void
{
var loader:SWFLoader = FontLoader.getLoader("Myriad");
_fontClass = loader.getClass("Myriad")
Font.registerFont(_fontClass);//throws error here...The value specified for argument font is invalid.
}
_fontClass seems to load properly, but I cant seem to access the font. Any insight on what might be wrong would be greatly appreciated. Thanks ^.^