Is the app swf and the loaded swf in the same folder? Otherwise there might be issues with security. It still shouldn’t crash the app, but there might be a bug in how some SWF security is handled.
Apache Flex Team
Thanks for the anwser .
I put them in the same folder and even tried to load it from my localhost (ex: http://127.0.0.1/mySWFToLoad.swf) but I never reach the point of the security error, everytime it crashed before.
Is it possible that this error is a flash internal error ?
Technically this is a flash error. AIR is never supposed to just quit. How did you create the font swf? Can you load it with a non-Flex ActionScript-only test app?
My 'library.swf' with fonts has an empty scene. It contains only my embedded fonts in the library with the sharing property "export for runtime sharing" (url pointing on the library.swf).
In fact, I already load it with a Flash application (not a test app) and it works perfeclty. It only crashes when compiled with Flex AIR app.
I've made many tests with most basics applications Flash and Flex with only a Loader in the code.
It works in Flash, Flex web app but not in Flex AIR.
There is a thing I don't understand. I have the imported items from the library.swf in the library of the page.swf (written as imported). If theses items are not called on the stage, the AIR app will work, but if its there since the beginning it crashes.
I'll try to search if it was an ApplicationDomain error, unsuccessfully.... maybe my test was wrong.
From now, I don't know in what direction I can search.
Any Ideas ? What else can I test ?
Thanks for the help.
Make a simple ActionScript-only project for AIR that loads the SWF and see what happens. If it fails, post the code for the project.
The simplest code :
<?xml version="1.0" encoding="utf-8"?>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:SWFLoader source="page.swf" />
Crashes in AIR app but works in web app.
Library.swf is in the same folder than page.swf. And a shared font in the library.swf is imported and used on the stage of page.swf.
I am confused by your description of what page.swf is doing with library.swf. Is it loading library.swf at runtime? Or something else?
What does the console output show for this simple app?
AIR has different security rules than a web-app so that could be a factor, but it still shouldn’t crash.
Okay, it's a little bit complicated to explain the relation between page.swf and library.swf so :
The output of the test app :
[SWF] test2.swf - 2,155,881 bytes after decompression
[SWF] page.swf - 1,609 bytes after decompression
and then crash without any messages.
Yeah, I know that security rules are differents and it surely come from this but it's just a little bit difficult to know without any traces.....
Whatever, thanks for the help !
I would recommend you use Flash Pro to create a super simple AIR app that loads page.swf (and therefore library.swf). That will help determine if there is something about Flex code that is causing a problem or if it is entirely a Flash/AIR thing. If it is Flex-specific, we can dig deeper and will have a point of reference.
It's seems to be a Flash/AIR thing. I tried this simple code in a Flash/AIR app :
var loader:Loader=new Loader();
It crashed the same way than in Flex/AIR. But this code still works in a Flash web app.
I tried to load library.swf first (via Loader) or to import its contents in the Flash/AIR library before compiling but no changes.
OK, well you can take this up with the Flash/AIR folks at Adobe. But I would play around with the LoaderContext parameter to loader.load() to see if you can find a workaround. And you might need to hand code the way page.swf loads library.swf in order to control the LoaderContext on that load as well.
Ok thx. I'll contact the Flash/AIR Adobe support and do some tests about the LoaderContext.
Thanks for the help.