Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Adobe Flex SDK 4.5 (Release)
-
None
-
None
-
Affected OS(s): Windows
Affected OS(s): Windows XP
Browser: Internet Explorer 6.x
Language Found: English
Description
It isn't very clear how custom themes should be managed in a modular application.
After reading the documentation, I prepared a custom theme creating a Flex Library Project that includes a defaults.css file and a set of MXML spark skins. The defaults.css is used to define the skin to use for custom components and for standard Spark components (e.g. an alternative skinClass for spark.components.Button, as well the skinClass for mypackage.myCustomSkinnableComponent).
Then, I created a modular application in a Flex Project. Now, how should I link the compiled theme file?
My first guess is putting it in the <app>-config.xml <theme> section, because this will be picked-up when compiling in Flash Builder as well as running MXMLC from the command line (for release builds). However in this way the styles are correctly applied in the main application, but won't be used by the modules (default skins still applied, and/or errors due to missing skins for custom components).
So I tried to add the -compiler.isolated-styles=false option - I had to put it in the compiler options, because setting it in <app>-config.xml of the main application had no effect (probably this configuration file is not applied during modules compilation?)... while this seems to work, it creates sporadic errors due to missing skins in modules, and anyway it's not raccomended by the documentation (danger of memory leaks and other issues).
The last method I tried is removing the theme declaration from <app>-config.xml and specifying the theme in the additional compiler options of the project properties using a -theme+= option. This way the modules seems to works correctly, but I don't like this method very much: additional compiler options won't be picked up from MXMLC command-line compiler (thus I have to duplicate these options in Flash Builder and in build scripts, with risk of misalignments) and, more importantly, because the size of each modules' SWF have increased: are we duplicating skin classes in each module with this option?
Note that I never manually put the theme SWC in the library path of the Flex application, because I don't need (and I don't want) to explicitly reference skin classes: I like the idea that the defaults.css is managing the component/skin association in a decoupled manner.
I read the documentation sections About Themes (http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f85.html) and Modular Applications Overview, especially the Using styles with modules paragraph (http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-799a.html#WSda78ed3a750d6b8f1b97f82d12508050aa0-8000). This last help page cover the styles inheritance system for modules, but do not provide any detail about using custom themes with modular applications (and the related linking/optimization issues).
Can you please describe the suggested way to use custom themes in modular applications, or point me to the correct documentation if this topic is already covered somewere?
Thank you