Loading Modules/Runtime CSS into an AIR App
For those planning to load a Flex module into your AIR application from a remote server: take a look at this post before beating your head against the wall with this ambiguous error message Error: Unable to load style(SWF is not a loadable module).
Basically, loaded SWF’s are not allowed to be in the same security domain as your AIR app. Since modules and external styles loaded using StyleManager.loadStyleDeclaration() try to load themselves into the current security domain, an error will be thrown. The only workaround it appears is to bundle those modules with your application when it’s downloaded. Any new modules you want to add to your application at a later time can be downloaded using AIR’s update API via Updater.update().
Haven’t tried that yet. But I think I’m going to take the Updater approach. I figure since it’s an AIR up, the user shouldn’t have to download anything unless there’s an update.
Thanks for the post. I ran into this exact issue today, and Tim’s comment was the tip I needed to make it work. Note that modules have an internal Loader process, so in order to make this work, you need to copy the ModuleLoader class to your application and change the Loader to a URLStream/LoadBytes instead. Its a bit convoluted, but it does work.
Sorry, mx.modules.ModuleManager class.
[...] [3] - Another solution using AIR Update framework: http://www.intriguemedia.net/2008/02/22/loading-modulesruntime-css-into-an-air-app/ [...]
Our development team faced the same problem as your and we have the solution like tim and Lanny suggested, here is the post http://blog.esofthead.com/?p=117
Hi,
Have you also considered downloading the swf as a binary from the air app and then access it locally via SWFLoader? I am currently doing some research on this for one of our customers. It seems to work (at the first sight).
Have a nice day!
Tim