Unfortunately I can’t share the link I have to showcase this but I will share the code used to do it. This is remarkably simple to do.
First, you should know it isn’t as easy as writing CSS and pointing some class source path to the CSS file online. There is only 1 other step you need to perform.
**The Setup Steps**
# In your project, create your CSS (if not already available) to your hearts content.
# Right click on your CSS file in the Flex Navigator. You will see _Compile CSS to SWF_ in the context menu, click it. Your CSS file will be compiled into a loadable “style” swf.
# Upload the “style” swf to some url.
**The Code**
Now that your “style” is created you merely have to tell Flex to load it. There is a delay since the style swf has to be loaded so be mindful.
# Import mx.styles.StyleManager, if needed.
# Add an event listener to your mx:Application (“creationComplete or applicationComplete”:https://www.johncblandii.com/2008/02/flex-3-mxapplicationapplicatio.html). For our purposes this second let’s call it _init()_.
# In _init()_ add the following code: StyleManager.loadStyleDeclarations(“path to your style swf”,true, true);
That’s it. No, seriously…that’s it. 🙂
There is 1 tid-bit you should know about. The natural thing to do is to then allow your app to change styles after the initial load. Well, not a problem. Use the same code and you’re good to go but there is a gotcha.
bq. StyleManager.unloadStyleDeclarations(“path to previously loaded swf”);
Calling that function will clear all of the previously selected styles. This way if the new style doesn’t fully cover the same styles used in the previous style you won’t see remnants of the old style hanging around (like a background image, etc).
Hope this helps.