I've read some other threads on this topic that were related to the pre-release versions, but I can't get a complete answer get. I also opened an issue in the bug tracker (https://bugs.adobe.com/jira/browse/SDK-30748), but I'm also posting here, hoping to get some help.
Basically, I have a bunch of skin classes for the standard Spark controls (e.g. s:Button), as well as other skin classes for my custom SkinnableComponent objects. I need to reuse those skins in many projects, so I created a theme: I put in a Flex Library Project all my skin classes, all related graphical assets, and a defaults.css stylesheet that associates each component with its correct skinClass.
Now, in my modular application project, what is the correct method to link this compiled theme SWC? I tried different ways, and found some issue for each one:
- In <app>-config.xml, using the <theme> compiler option: this way, modules don't pick up the skinClass correctly (default components use the standard Spark skin, and for custom components I get many skinNotFound errors).. its a pity, I like this method because command-line invocations of MXMLC (build scripts) automatically apply the settings in the config.xml file, while I have to manually keep in sync any additional compiler argument.
- In <app>-config.xml, using the <theme> compiler option and add -compiler.isolated-styles=false: seems to work, but not always.. moreover, the option must be put in additional compiler argument, and not in <app>-config.xml, to have effect... I understand that the config.xml file, in a modular application, is only applied to the main application (or that it must replicated with correct name for each module)?
- In additional compiler arguments, using the theme+= option.. these arguments should be used also for modules compilation, and this seems the most effective solution at the moment (swf size of compiled modules has slightly increased), but skinNotFound errors still happens sometimes, usually going away after a clean build.. maybe this has something with the incremental build performed by Flash Builder and/or optimization of modules?
Right now, I've tried adding also -keep-all-type-selectors in the compiler arguments to see how it goes...
Is my scenario supported by Flex 4? How should I setup my environment? I read how to create custom themes in the official documentation (http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f85.html) and a specific help section exists about using styles with modules (http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-799a.html#WSda 78ed3a750d6b8f1b97f82d12508050aa0-8000), but it only cover simple style sheets, no specific information about compiled themes and the suggested linking strategy.
I'm using Flash Builder 4.5.1 and compiling with Flex SDK 4.5.0 (both application and theme), the project use some Halo components (e.g. DateField) but almost all components are Spark, and I use Spark component for <s:Application> and <s:Module>. Modules are optimized for the main application, and are loaded using the ModuleManager.
Thanks in advance for any help.