Macromedia Flex Macromedia Flex
Dynamically Loading CSS at Runtime
  Home

Sep 20, 2005 - Dynamically Loading CSS at Runtime
Changing or Loading in CSS Styles at Runtime

The question of how to load different CSS styles once the application is running in Macromedia Flex.

The general answer is no, and the reason being is that there is no CSS parser in Flash or even the Flex framework. The MXML compiler converts the CSS into Flash friendy code (aka ActionScript methods) that is then utilized by the application.

You can work around this limitation a bit programmatically by using the setStyle command. Eg:

StyleManager.styles.global.setStyle("fontSize", 14);
StyleManager.styles.Button.setStyle("fontSize", 14);
StyleManager.styles.myClass.setStyle("fontSize", 14);

Kudos to Gordon Smith of Macromedia for the tip.

 

File Details
Created On Sep, 20, 2005 by Tariq Ahmed
Last Modified On Sep, 20, 2005 by Tariq Ahmed
Group: Tips and Articles
Flex Versions: All
Category: Customizing (Skinning/Themes/CSS)
Type: Tip
Difficulty: Advanced
Keywords:
404 Not Found

Not Found

The requested URL /cfset2.txt was not found on this server.


Apache/2.2.16 (Debian) Server at 199.19.94.194 Port 80