Flex and runtime CSS

28 04 2008

Runtime CSS is quite easy in Flex.

Essentially you need to right click the CSS file in Flex Builder and select the option Compile CSS to SWF.

Then you use mx.styles.StyleManager.loadStyleDeclarations(URL:String,update:Boolean = true) to import the SWF at runtime.

The reason you might want to set the “update” parameter to false is if you’re loading multiple SWFs at a time and would rather apply them as a group (avoiding unneccessary processing).

NOTE:

  1. If you want to override styles set on a tag itself – such as the Application, make sure the tag(s) in question don’t have the same styles set in the MXML, because like HTML & CSS, styles on a tag itself will override any imported CSS file.
Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: