O'Reilly logo

Programming Flex 2 by Joey Lott, Chafic Kazoun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Themes

Themes provide a way to compile all .css files, graphical skin asset files, and programmatic skin classes in an .swc file that you can then tell the Flex compiler to use for your Flex application. This has two primary advantages:

  • It allows you to precompile style and skin assets so that application compilation is faster.

  • It allows you to more easily distribute and drop in preconfigured styles and skins for Flex applications.

Themes are fantastic when, say, you have a corporate style guide that you need to implement across many applications. Rather than having to distribute all the .css files, graphical elements, and programmatic skin classes, you can distribute just one .swc file.

Setting a Theme

Setting a theme for a Flex application is very simple. All that is necessary is to add a -theme compiler option to mxmlc. If you are compiling from the command line (or using Ant or another automatic build program), simply add -theme themeFile.swc to the compiler options, as in this example:

mxmlc -theme corporate.swc Main.mxml

If you are using Flex Builder to build your application, you should open the project properties, select the Flex Compiler option, and add -theme themeFile.swc to the additional compiler arguments field.

Creating a Theme

In order to use a theme, you clearly must have a theme first. A theme must contain at least one .css file, and likely contains additional assets such as image assets and/or a programmatic skin class. A theme file must be precompiled as an .swc file. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required