Just a quick issue I ran into today whilst trying to make use of runtime font loading inside Flash Builder. Where as before in Flex 3 it was a simple case of creating a class to construct a swf that would then be loaded in the main application. Today I ran into an Error #1014 - Class mx.core::FontAsset could not be found, when running the main application.
The fix as it seems is to add this to the compiler arguments of your font library swf.
Now if like me you use Ant Builder to compile your projects - simply add to your mxmlc tag within your ant script as shown here
Update: Adobe mention a fix to the noticeable file size increase. It appears that the increase is due to it including all classes that our "classes inherit from plus other framework dependencies" so we need to amend this script a little to something more like
mxmlc -runtime-shared-library-path=c:/p4/flex/flex/sdk/frameworks/libs/framework.swc, framework_3.0.183453.swz,,framework_3.0.183453.swf rsls/SimpleApp.mxml
For a more detail explanation check out Adobe's comments
November 4, 2010 at 9:24 am
Thank a lot ! Very helpful for me!
January 19, 2011 at 12:32 am
at last!! thank you
March 8, 2011 at 9:48 am
This post has been so helpful. Thanks.
By the way, if you compile using that compiler arg, the resultant swf weights almost 200ks while if you compile without it, it will weight near 160ks less (in my test 30ks aprox).
Another thing you can try, is loading your font library (swf) setting a trustable LoaderContext:
loader.loaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
This should work too and will keep your swf files lighter.
March 25, 2011 at 5:50 am
Towards the end it explains that the increase in file size is due to the static-link-runtime-shared-libraries=”true” embeding various aspects of the framework.swc into your swf file. It offers an alternative. Though i haven’t tested this yet.
Thanks for the tip though.
March 29, 2011 at 4:10 pm
Thanks for the heads up Emile – this is one of the most used resources on my site so this tip will help a lot of people!
May 20, 2011 at 1:07 am
Yay! “-static-link-runtime-shared-libraries=true” did it for me! 🙂
April 3, 2012 at 6:00 am
Thanks a lot! did it for me