Search code examples
cssthemesflex4skin

Changing Flex 4 theme (CSS+Skin) at run-time?


I have a Flex 4/Blaze/Java application and would like to provide my users with a way to switch between several pre-determined skins. Does anyone have a good example of how to do this?

Ideally, the list of themes would be provided by the server -- where the themes are stored. Or do I have to compile in all possible themes into the swf ahead of time?


Solution

  • Check out runtime loading of style sheets.

    You can package each style sheet with its skin classes in a swf that can be dynamically loaded by your application at run time using styleManager.loadStyleDeclarations("yourTheme.swf");

    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f8c.html