-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Flex 3 with Java

Flex allows loading of stylesheets at runtime using the StyleManager
class. By using this technique, you can dynamically change your application's appearance at any time and also separate your content from presentation logic. For example, you can embed assets such as images or media files used by your application into a stylesheet and load it at runtime. This technique decreases application loading time, since assets (stylesheets) are not embedded into the main application.
For loading stylesheets at runtime, you need to compile your CSS file(s) into an SWF file, and then use the StyleManager.loadStyleDeclarations("cssfile.swf")
method to load it. The steps for loading a stylesheet at runtime are given below. We will use the existing project created in the previous exercise, StylingExample:
1. Open the StylingExample
Flex project.
2. Right-click on the mystyle.css
file in the Flex Navigator view and select the Compile CSS to SWF option from the pop-up menu...
Change the font size
Change margin width
Change background colour