I'm developing two Flex applications that need to have the same look-and-feel. Is there a way to define the stylesheet in only one place and use it in both projects, for example, by adding it to an SWC?
A:
We've got a stylesheet, fonts, and a bunch of skin classes compiled into a SWC. The fonts and CSS files are all located in /src and included as assets in the compile. It's then referenced by the application like so:
<mx:Style source="PathwaysVisualTheme.css"/>
There are other ways to do it, like defining a proper "Flex Theme", which means you don't have to reference the css file in your application, but this replaces the default Halo stylesheet rather than overriding it, so you need to define everything instead of just where it differs from Halo.
Sophistifunk
2010-04-12 05:23:12
A:
Compile the CSS into a swf and just include it in each project.
StyleManager.loadStyleDeclarations( pathToStyleSwf );
Gregor Kiddie
2010-04-13 13:53:15