Chapter 4.1. Loading a Style Sheet at Runtime

In Flex 3, you can compile a CSS file as a SWF (pronounced “swif”) and load it at runtime. With this feature you could allow users to customize the look of an application with the click of a button or change the appearance of an application based on specific information, like login credentials. In this walkthrough, you will create two simple but different style sheets, compile them as SWFs, and then implement a way to switch between them at runtime.

  1. Create a new MXML application called RuntimeStyling.mxml.

  2. Create two new CSS files called red.css and blue.css (File > New > CSS file).

  3. In both CSS files, you will be creating styling for a button. One will be red and the other blue. Open red.css and use a ...

Get Creating Visual Experiences with Flex 3.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.