
chris12345
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
ScrollTrigger Demos
Downloads
Posts posted by chris12345
-
-
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 ^.^
Loading Font from external swf
in Loading (Flash)
Posted
Thanks for the response. I've pretty much tried everything in that thread with no luck. I can load up the class just fine, but it fails when I try to register the font. So the only thing I can really think of is it being an issue with how I put together the swf. But all I'm doing is dragging a dynamic textfield onto the stage, setting the font, then hitting embed in the propertiies panel. Then I setup the name, character ranges, and export for actionscript, which from what I've read is correct so I'm not sure what could be the issue.